4> CREATE TABLE salesman(
5> no INT NOT NULL UNIQUE,
6> fname CHAR(20) NOT NULL,
7> lname CHAR(20) NOT NULL,
8> product_no CHAR(10))
9> GO
1> CREATE TABLE product(
2> product_no CHAR(10) NOT NULL UNIQUE,
3> product_name CHAR(20) NULL,
4> price MONEY NULL)
5> GO
1> ALTER TABLE product
2> ADD CONSTRAINT prim_prod PRIMARY KEY(product_no)
3> GO
1>
2>
3> ALTER TABLE salesman
4> ADD CONSTRAINT prim_sales PRIMARY KEY (no),
5> CONSTRAINT foreign_sales FOREIGN KEY(product_no)
6> REFERENCES product
7> GO
1>
2> drop table salesman;
3> GO
1> drop table product;
2> GO
1>
|