0
|
1 DROP TABLE Doctor
|
|
2 GO
|
|
3
|
|
4 DROP TABLE Patient
|
|
5 GO
|
|
6
|
|
7 DROP TABLE Person
|
|
8 GO
|
|
9
|
|
10 CREATE TABLE Person
|
|
11 (
|
|
12 PersonID SERIAL NOT NULL,
|
|
13 FirstName NVARCHAR(50) NOT NULL,
|
|
14 LastName NVARCHAR(50) NOT NULL,
|
|
15 MiddleName NVARCHAR(50),
|
|
16 Gender CHAR(1) NOT NULL,
|
|
17
|
|
18 PRIMARY KEY(PersonID)
|
|
19 )
|
|
20 GO
|
|
21
|
|
22 INSERT INTO Person (FirstName, LastName, Gender) VALUES ('John', 'Pupkin', 'M')
|
|
23 GO
|
|
24 INSERT INTO Person (FirstName, LastName, Gender) VALUES ('Tester', 'Testerson', 'M')
|
|
25 GO
|
|
26
|
|
27 -- Doctor Table Extension
|
|
28
|
|
29 CREATE TABLE Doctor
|
|
30 (
|
|
31 PersonID int NOT NULL,
|
|
32 Taxonomy nvarchar(50) NOT NULL
|
|
33 )
|
|
34 GO
|
|
35
|
|
36 INSERT INTO Doctor (PersonID, Taxonomy) VALUES (1, 'Psychiatry')
|
|
37 GO
|
|
38
|
|
39 -- Patient Table Extension
|
|
40
|
|
41 CREATE TABLE Patient
|
|
42 (
|
|
43 PersonID int NOT NULL,
|
|
44 Diagnosis nvarchar(100) NOT NULL
|
|
45 )
|
|
46 GO
|
|
47
|
|
48 INSERT INTO Patient (PersonID, Diagnosis) VALUES (2, 'Hallucination with Paranoid Bugs'' Delirium of Persecution')
|
|
49 GO
|
|
50
|
|
51
|
|
52 DROP TABLE Parent
|
|
53 GO
|
|
54 DROP TABLE Child
|
|
55 GO
|
|
56 DROP TABLE GrandChild
|
|
57 GO
|
|
58
|
|
59 CREATE TABLE Parent (ParentID int, Value1 int)
|
|
60 GO
|
|
61 CREATE TABLE Child (ParentID int, ChildID int)
|
|
62 GO
|
|
63 CREATE TABLE GrandChild (ParentID int, ChildID int, GrandChildID int)
|
|
64 GO
|
|
65
|
|
66
|
|
67 DROP TABLE LinqDataTypes
|
|
68 GO
|
|
69
|
|
70 CREATE TABLE LinqDataTypes
|
|
71 (
|
|
72 ID int,
|
|
73 MoneyValue decimal(10,4),
|
|
74 DateTimeValue datetime year to fraction(3),
|
|
75 DateTimeValue2 datetime year to fraction(3),
|
|
76 BoolValue boolean,
|
|
77 GuidValue char(36),
|
|
78 BinaryValue byte,
|
|
79 SmallIntValue smallint,
|
|
80 IntValue int,
|
|
81 BigIntValue bigint
|
|
82 )
|
|
83 GO
|
|
84
|
|
85 DROP TABLE TestIdentity
|
|
86 GO
|
|
87
|
|
88 CREATE TABLE TestIdentity (
|
|
89 ID SERIAL NOT NULL,
|
|
90 PRIMARY KEY(ID)
|
|
91 )
|
|
92 GO
|