Re: no records returned
James Moe <jimoe@sohnen-moe.com>
From: "James Moe" <jimoe@sohnen-moe.com>
To: "Postgresql General Mail List" <pgsql-general@postgresql.org>
Date: 2003-10-26T22:46:58Z
Lists: pgsql-general
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sat, 25 Oct 2003 20:19:49 -0700 (MST), Lynn.Tilby@asu.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-----