Re: no records returned

From: "James Moe" <jimoe(at)sohnen-moe(dot)com>
To: "Postgresql General Mail List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: no records returned
Date: 2003-10-26 22:46:58
Message-ID: auto-000000760067@sohnen-moe.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 25 Oct 2003 20:19:49 -0700 (MST), Lynn(dot)Tilby(at)asu(dot)edu wrote:

>Could you explain to a newbie WHY the like and % at
>the end of the literal works when the normal select does
>not?
>
The "%" is a wildcard character in SQL, the same as "*" in many file systems. It
matches 0 or more characters. Also "_" matches any single character, similar to
"?", or "." in regular expressions.
There is likely one or more spaces after the visible characters. Using a "%"
after ZRAN matches ZRAN plus anything else following that pattern.
The implementation of the LIKE operator is a somewhat uneven in my experience.
Depending on the database it can only be used to match strings, or to do a
case-insensitive compare, or is equivalent to "=" with "=" extended to string
operations. In most cases, though, the best practice is to use it for strings
especially when using regular expressions like "%"; and to use "=" for numeric and
exact matching.

- --
jimoe at sohnen-moe dot com
pgp/gpg public key: http://www.keyserver.net/en/
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0 OS/2 for non-commercial use
Comment: PGP 5.0 for OS/2
Charset: cp850

wj8DBQE/nE7isxxMki0foKoRAkJjAJ9lpqeC8y+Go0tXclwIM8XzvaRd1QCgtn8i
26WzEwf8HNPY5iqY6ZckrmY=
=DY5x
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-10-26 22:51:37 Re: shared memory on OS X - 7.4beta4
Previous Message Relaxin 2003-10-26 22:42:27 Question about the Internals