-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhuman_Create-Table.sql
More file actions
37 lines (31 loc) · 1.01 KB
/
human_Create-Table.sql
File metadata and controls
37 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- creating tables in sql.......
-- Create Table --name_of_table (
-- column_name column_datatype optional constraint,
-- column_name column_datatype optional constraint,
-- .........
-- column_name column_datatype optional constraint,
-- CONSTRAINT name_of_table_PK primary key(column_name)
-- CONSTRAINT name_of_table_FK foreign key(column_name)
--
-- );
USE demo;
CREATE TABLE Human (
HumanId Integer NOT NULL,
Name Char(35) NOT NULL,
Color Char(30) NOT NULL,
Sex Char(10) NULL,
BloodGrup Char(35) NULL,
CONSTRAINT Human_PK PRIMARY KEY(HumanId)
);
CREATE TABLE Games (
OrderNumber Integer NOT NULL,
StoreNumber Integer NOT NULL,
StoreZIP Char (9) NULL,
OrderMonth Char (12) NOT NULL,
OrderYear integer NOT NULL,
OrderTotal Numeric(4,2) NULL,
HumanId Integer NOT NULL,
CONSTRAINT Games_PK PRIMARY KEY(OrderNumber),
CONSTRAINT Games_FK FOREIGN KEY(HumanId)
REFERENCES Human(HumanId)
);