Re: [SQL] Celko's Puzzle Number 5

2006-07-08 Thread Richard Broersma Jr
> http://www.postgresql.org/docs/8.1/interactive/functions-matching.html > > Any of these CHECK expressions should work: > > CHECK (alpha_only SIMILAR TO '[A-Za-z]+') > CHECK (alpha_only ~ '^[A-Za-z]+$') > CHECK (alpha_only ~* '^[a-z]+$') > > Unfortunately, even though SIMILAR TO has been

Re: [SQL] Celko's Puzzle Number 5

2006-07-08 Thread Michael Fuhr
On Fri, Jul 07, 2006 at 11:34:57PM -0700, Richard Broersma Jr wrote: > "How do you ensure that a column will have a single alphabetic > character string in it? (That means no spaces, no numbers, and > no special characters.)" You can check patterns with regular expressions. PostgreSQL supports SI

[SQL] Celko's Puzzle Number 5

2006-07-07 Thread Richard Broersma Jr
No matter how I try it, I can't getting the book's answer for this puzzle to work. Does anyone know of a solution that will work for this problem. The Problem is: "How do you ensure that a column will have a single alphabetic character string in it? (That means no spaces, no numbers, and no s