Re: [SQL] Newbie questions - Mailing list pgsql-sql

From Remigiusz Sokolowski
Subject Re: [SQL] Newbie questions
Date
Msg-id Pine.GS4.4.02A.9812140916340.14291-100000@netra.gdansk.sprint.pl
Whole thread Raw
In response to Newbie questions  ("Frank Morton" <fmorton@base2inc.com>)
Responses Re: [SQL] Newbie questions
Re: [SQL] Newbie questions
List pgsql-sql
> Question #1
>
> If a select might match MANY rows, how can I limit it to say 50?
>
> I thought you could do:
>
> select * from table limit 50;

look at description of cursor in man - there are also examples
begin work;
declare cursor bookmark for
your select statement;
fetch 50 in bookmark;
close bookmark;
commit;B

>
> Question #2
>
> In doing a select, is there a way to ignore if the case of the key?
>
> For example, if I have a table called animals with an id column and
> it might contain "dog" or "DOG" or "Dog" and I want to match all
> of them, how do I do it, with or without the "like" operator?
>
> I'd like to say:
>
> select * from animals where id='dogs' ignore case;

look at operators in docs
~~ - LIKE operator
~* - match(regex), case insensitive operator
I have no idea which is better
    Rem
p.s. I could make some mistakes in this examples - check in amnual or docs
--------------------------------------------------------------------------------
Remigiusz Sokolowski      e-mail: rems@gdansk.sprint.pl
--------------------------------------------------------------------------------



pgsql-sql by date:

Previous
From: "Vladimir Dobrokhotov"
Date:
Subject: binary search
Next
From: Postgres DBA
Date:
Subject: Re: [SQL] Newbie questions