Hi-

that is a great example and I will definitely use it.
However, the constraint you listed goes at the end.
I am also wondering about the constraint in the column-def like
column-def ::= name [type] [[CONSTRAINT name] column-constraint]* 

CREATE [TEMP | TEMPORARY] TABLE table-name (
    column-def [, column-def]*
    [, constraint]*
)

I am trying to get this last piece because I want to be able to
delete,modify, and add
tables and columns in my gui program in addition to being able to
execute sql statements 
(which I already have).
There are a dozen of these programs out there now but I wish to make my
own.

thanks for helping me dave,
marvin

-----Original Message-----
From: David M. Cook [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 20, 2004 8:11 PM
To: [EMAIL PROTECTED]
Subject: Re: [sqlite] basic table level stuff


On Tue, Jan 20, 2004 at 05:15:15PM -0500, jim wrote:

> if they already have these constraints at the column level, why do 
> they need them a second time as in ... name [type] [[CONSTRAINT name] 
> column-constraint]*

Because you may want a composite primary key or set of unique columns.
A simple example is

CREATE TABLE person (
       person_id INTEGER PRIMARY KEY
       lastname TEXT,
       firstname TEXT,
       UNIQUE (lastname, firstname)
);

Dave Cook

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to