Selecting Varchar range.

From: Daryl Beattie <dbeattie(at)insystems(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Selecting Varchar range.
Date: 2002-08-12 12:43:42
Message-ID: 4160E6FC08ABD21191F000805F857E9304DF45AF@mail.insystems.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear PostgreSQL people,

I didn't find this in the archives or the idocs, so...

How does one select a varchar range? The meaning of my question is
best illustrated by the following completely hypothetical and totally
imaginary situation:
Let's say I have a table of musical artists:

CREATE TABLE Artists (
Id SERIAL PRIMARY KEY,
Name VARCHAR(100)
);

And I want to eventually display only the artists from 'Aa' to 'Am'.
Naturally doing a select where Name like 'A%' will not return me what I
want.
Any ides on how to do this? [Will "SELECT Name FROM Artists WHERE
Name > 'Aa%' AND Name < 'Am%';" work?]

Bonus question: How do I select artists whose names start with a
number?

I'd appreciate any help. Thanks! :)

Sincerely,

Daryl.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vince Vielhaber 2002-08-12 12:48:44 Re: Selecting Varchar range.
Previous Message ktt 2002-08-12 12:23:19 Re: start selecting from particular ID