Thread: Select

Select

From
"Marcelo Pereira"
Date:
Hi All,

I'm in trouble to build a select...
I have a table (for example) like this:


Table: Employee
empCod | empName | empDepth
---------+-----------+-----------
     1       |   Anand     |    any
     2       |   Oliver      |    any
     3       |    Peter      |    any
     4       |     Bob       |    any
     5       |    David     |     any
     6       |     Paul       |    any

Now I would like to select all employees which name begins with the letter
"P".....

> Select * from employee where "name-begin-with-letter-P"....  :-)

How can I do it ???

Thanks in advance,

Marcelo Pereira
Unicamp - Brazil


Re: Select

From
"mike"
Date:
SELECT * FROM employee WHERE empname LIKE 'P%'

the above would work only if you want to search for people w/ names starting
w/ P

Mike

----- Original Message -----
From: "Marcelo Pereira" <gandalf@sum.desktop.com.br>
To: <pgsql-general@postgresql.org>
Sent: Tuesday, April 17, 2001 5:23 AM
Subject: Select


> Hi All,
>
> I'm in trouble to build a select...
> I have a table (for example) like this:
>
>
> Table: Employee
> empCod | empName | empDepth
> ---------+-----------+-----------
>      1       |   Anand     |    any
>      2       |   Oliver      |    any
>      3       |    Peter      |    any
>      4       |     Bob       |    any
>      5       |    David     |     any
>      6       |     Paul       |    any
>
> Now I would like to select all employees which name begins with the letter
> "P".....
>
> > Select * from employee where "name-begin-with-letter-P"....  :-)
>
> How can I do it ???
>
> Thanks in advance,
>
> Marcelo Pereira
> Unicamp - Brazil
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>


Re: Select

From
newsreader@mediaone.net
Date:
On Tue, Apr 17, 2001 at 09:23:02AM -0300, Marcelo Pereira wrote:
> Hi All,
>
>
> Now I would like to select all employees which name begins with the letter
> "P".....
>
> > Select * from employee where "name-begin-with-letter-P"....  :-)
>

select * from employee where email ~ '^P';

or if case does not matter

select * from employee where upper(email) ~ '^P';