REFERENCES customer(cust_id) (from another table) : REFERENCES « Constraints « SQL Server / T-SQL Tutorial






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>








7.4.REFERENCES
7.4.1.Self-Referencing Tables
7.4.2.Primary key and foreign key
7.4.3.Making a Table be Self-Referencing
7.4.4.ON UPDATE CASCADE ON DELETE NO ACTION
7.4.5.REFERENCES customer(cust_id) (from another table)