Download presentation
Presentation is loading. Please wait.
Published byBethanie Brown Modified over 8 years ago
1
MS SQL 2005
19
Create Table Cust USE jxc00 GO CREATE TABLE cust ( cust_id smallint IDENTITY(1,1) NOT NULL, cust_name char(10) NOT NULL, cust_addr varchar(50) NULL CONSTRAINT pk_cust PRIMARY KEY (cust_id) )
38
Create Table Soh USE jxc GO CREATE TABLE soh( sale_no smallint IDENTITY(1,1) NOT NULL, sale_date datetime NULL, cust_id smallint NOT NULL, tot_amt numeric(8,2), CONSTRAINT PK_soh PRIMARY KEY (sale_no) ) GO USE jxc GO ALTER TABLE soh WITH CHECK ADD CONSTRAINT FK_soh_cust FOREIGN KEY(cust_id) REFERENCES cust (cust_id)
40
Create Table Cust CREATE TABLE sod ( sale_no smallint NULL, prod_id smallint NULL, sale_qty numeric (6, 0) NULL, sale_pric numeric (8, 2) NULL, exte_pric numeric (8, 0) NULL ) GO ALTER TABLE sod WITH CHECK ADD CONSTRAINT FK_sod_prod FOREIGN KEY( prod_id ) REFERENCES prod ( prod_id ) GO ALTER TABLE sod WITH CHECK ADD CONSTRAINT FK_sod_soh FOREIGN KEY( sale_no ) REFERENCES soh ( sale_no ) GO ALTER TABLE sod CHECK CONSTRAINT FK_sod_prod
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.