-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP13.sql
57 lines (55 loc) · 1.12 KB
/
P13.sql
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
CREATE DATABASE Movies
CREATE TABLE [Directors](
[Id] INT PRIMARY KEY IDENTITY,
[DirectorName] NVARCHAR(50) NOT NULL,
[Notes] NVARCHAR(200)
)
CREATE TABLE [Genres](
[Id] INT PRIMARY KEY IDENTITY,
[GenreName] NVARCHAR(50) NOT NULL,
[Notes] NVARCHAR(150)
)
CREATE TABLE [Categories](
[Id] INT PRIMARY KEY IDENTITY,
[CategoryName] NVARCHAR(50) NOT NULL,
[Notes] NVARCHAR(70)
)
CREATE TABLE [Movies](
[Id] INT PRIMARY KEY IDENTITY,
[Title] NVARCHAR(50) NOT NULL,
[DirectorId] INT NOT NULL,
[CopyrightYear] INT,
[Length]TIME,
[GenreId] INT NOT NULL,
[CategoryId] INT NOT NULL,
[Rating] DECIMAL(3,2),
[Notes] NVARCHAR(200)
)
INSERT INTO [Directors]([DirectorName])
VALUES
('PETER'),
('IVAN'),
('GEORGE'),
('BRAD'),
('TOM')
INSERT INTO [Genres]([GenreName])
VALUES
('Comedy'),
('Horror'),
('Sky-fi'),
('Fantasy'),
('Documentary')
INSERT INTO [Categories]([CategoryName])
VALUES
('SPORT'),
('SCIENCE'),
('NATURE'),
('EXTREME'),
('HISTORY')
INSERT INTO [Movies]([Title],[DirectorId],[GenreId],[CategoryId],[Rating])
VALUES
('STAR-WARS',3,4,2,4.5),
('STAR',3,4,2,5.0),
('IT',1,1,4,2.0),
('FISHER',5,5,4,5.5),
('EUROSPORT',3,5,1,1.6)