summaryrefslogtreecommitdiffstats
path: root/servers/slapd/back-sql/rdbms_depend/mssql/testdb_create.sql
blob: 2034afd1d0ea2cd88b0fe3b9038e6a229ea83397 (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
CREATE TABLE authors_docs (
	pers_id int NOT NULL ,
	doc_id int NOT NULL 
)
GO

CREATE TABLE documents (
	id int IDENTITY (1, 1) NOT NULL ,
	abstract varchar (255) NULL ,
	title varchar (255) NULL ,
	body binary (255) NULL 
)
GO

CREATE TABLE institutes (
	id int IDENTITY (1, 1) NOT NULL ,
	name varchar (255) NOT NULL 
)
GO


CREATE TABLE persons (
	id int IDENTITY (1, 1) NOT NULL ,
	name varchar (255) NULL ,
	surname varchar (255) NULL ,
	password varchar (64) NULL
)
GO

CREATE TABLE phones (
	id int IDENTITY (1, 1) NOT NULL ,
	phone varchar (255) NOT NULL ,
	pers_id int NOT NULL 
)
GO

ALTER TABLE authors_docs WITH NOCHECK ADD 
	CONSTRAINT PK_authors_docs PRIMARY KEY  
	(
		pers_id,
		doc_id
	)  
GO

ALTER TABLE documents WITH NOCHECK ADD 
	CONSTRAINT PK_documents PRIMARY KEY  
	(
		id
	)  
GO

ALTER TABLE institutes WITH NOCHECK ADD 
	CONSTRAINT PK_institutes PRIMARY KEY  
	(
		id
	)  
GO


ALTER TABLE persons WITH NOCHECK ADD 
	CONSTRAINT PK_persons PRIMARY KEY  
	(
		id
	)  
GO

ALTER TABLE phones WITH NOCHECK ADD 
	CONSTRAINT PK_phones PRIMARY KEY  
	(
		id
	)  
GO