On Sun, Jul 11, 2010 at 07:51:18PM +0000, c...@comcast.net scratched on the 
wall:

> Creating a new db with the added constraint is not  problem for me
> at this time. 

> If I wanted to allows only values "yes" or "no" or "maybe" in the
> recommendation column would I do it like this when I created the table - 

>    recommendation varchar(4) CHECK(recommendation='yes' |
>   recommendation='no' | recommendation='maybe' ) 

  Basically, yes, although you want to use "or" not "|".  "|" is a
  bitwise operator (just like C) while "or" is a logical operator (like
  || in C).

  If might be better to just make this a foreign key to a
  "recommendation_value" table, however.  Then you can still limit the
  values, but you can alter the list as needed.  This also gives a GUI
  application some place to lookup the possible choices, which is
  useful for building drop-down menus, etc.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to