Re: select statement sorting

From: Julian North <jnorth(at)lastminute(dot)com>
To: 'Alexander Cohen' <alex(at)toomuchspace(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: select statement sorting
Date: 2004-03-31 16:17:45
Message-ID: A9F75F9AB514D611A69D0002A5AD9BED116CBAE2@lmnukex05.lastminute.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

you can do a lower on it to remove the case sensitivity.

select * from table order by lower(table_column) asc

-----Original Message-----
From: Alexander Cohen [mailto:alex(at)toomuchspace(dot)com]
Sent: 31 March 2004 16:32
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] select statement sorting

is it possible to have postgres return a "SELECT * FROM table ORDER BY
table_column" query that is not case sensitive order?

if i have these words in a column:

Alex
alex
Barbara
Cohen

i will get them back in the following order in the tuples:

Alex
Barbara
Cohen
alex

But i want them back likke this:

Alex
alex
Barbara
Cohen

Is this possible or do i need to sort them myself after the query
returns?

Also, i noticed that postgres will let me create groups, databases and
users with spaces in their names, is this ok or should i check this
beforehand and not allow this?

thanks!

--
Alexander Cohen
http://www.toomuchspace.com
(819) 348-9237
(819) 432-3443

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2004-03-31 16:19:07 Re: Some Documentation Changes
Previous Message Indibil 2004-03-31 16:07:42 Re: Error on deleting