Find, Find Next on an index, in SQL?
Others are telling me strongly to avoid LIKE because it does a whole table search. I like LIKE because it does just what I want, I don’t like whole table searches. I’m not sure who is right, you or them, when it comes to like. Thank you for this clarification below.
I’ll look into the command line utility for Postgres. Seems to be the learning thing to do.
> On Feb 6, 2018, at 12:26 PM, Alex Clay <aclay@mac.com> wrote:
>
> On Feb 6, 2018, at 15:19, Das Goravani <das@goravani.com> wrote:
>
>> I’m still wondering if with a character field, if >= starts with what you typed in as search criteria, and goes from there alphabetically. I don’t have the data in my app to test with such things.
>
> You don’t need a large set of data. Clifford, or someone else, recommend becoming familiar with psql, the command-line utility to access PostgreSQL. Here are some tests I ran in psql against a local database to see how the > operator behaves with text values:
>
>> # SELECT ‘a’ > ‘apple’;
>> ?column?
>> ———-
>> f
>> (1 row)
>>
>> # SELECT ‘apple’ > ‘b’;
>> ?column?
>> ———-
>> f
>> (1 row)
>>
>> # SELECT ‘ap’ > ‘a’;
>> ?column?
>> ———-
>> t
>> (1 row)
>>
>> # SELECT ‘a’ > ‘ap’;
>> ?column?
>> ———-
>> f
>> (1 row)
>
> So “ap” is greater than “a”, but “a” is not greater than “ap”.
>
> If you’re looking for one string begins with another, use ILIKE and a wildcard.
>
>> # SELECT ‘apple’ ILIKE ‘a%’;
>> ?column?
>> ———-
>> t
>> (1 row)
>
> Alex
> _____________________________________________________________
> Manage your list subscriptions at lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com