Presentation is loading. Please wait.

Presentation is loading. Please wait.

MS SQL 2005. Create Table Cust USE jxc00 GO CREATE TABLE cust ( cust_id smallint IDENTITY(1,1) NOT NULL, cust_name char(10)

Similar presentations


Presentation on theme: "MS SQL 2005. Create Table Cust USE jxc00 GO CREATE TABLE cust ( cust_id smallint IDENTITY(1,1) NOT NULL, cust_name char(10)"— Presentation transcript:

1 MS SQL 2005

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

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) )

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

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)

39

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

41


Download ppt "MS SQL 2005. Create Table Cust USE jxc00 GO CREATE TABLE cust ( cust_id smallint IDENTITY(1,1) NOT NULL, cust_name char(10)"

Similar presentations


Ads by Google