RE: [sqlite] column def vs. constraint at end of create table stmt

2004-11-03 Thread itIsMe
>>You can see that the only way to create a two-column constraint is to
use 
>>this syntax (unless you want to define an index, that is).

>>Guy


hi -

I can see where I was confused now.
I will make the required changes.

thanks for your help,
jim



Re: [sqlite] column def vs. constraint at end of create table stmt

2004-11-03 Thread Guy Hachlili
At 18:57 11/2/2004 -0500, you wrote:
if I have a column def statement for every field and specify unique and
primary constraints in each column def, what is the reason the
constraint that goes on the very end of the create table would be needed
[, constraint]*  
 column-def ::= name [type] [[CONSTRAINT name] column-constraint]*
 sql-command ::= CREATE [TEMP | TEMPORARY] TABLE table-name (
column-def [, column-def]*
[, constraint]*
)
Some database users like to have constraints for more then one column at a 
time; for example, creating a unique constraint for two columns together. 
As constraint is defined thus:

constraint ::=  PRIMARY KEY ( column-list ) [ conflict-clause ] |
  UNIQUE ( column-list ) [ conflict-clause ] |
  CHECK ( expr ) [ conflict-clause ]
You can see that the only way to create a two-column constraint is to use 
this syntax (unless you want to define an index, that is).

Guy