Mega Code Archive

 
Categories / MSSQL Tutorial / Constraints
 

REFERENCES customer(cust_id) (from another table)

3>  CREATE TABLE customer 4> ( 5> cust_id      int            NOT NULL  IDENTITY  PRIMARY KEY, 6> cust_name    varchar(50)    NOT NULL 7> ) 8> GO 1> 2> CREATE TABLE orders 3> ( 4> order_id    int        NOT NULL  IDENTITY  PRIMARY KEY, 5> cust_id     int        NOT NULL  REFERENCES customer(cust_id) 6> ) 7> GO 1>