-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLQuery Create Tables.sql
39 lines (37 loc) · 1.21 KB
/
SQLQuery Create Tables.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
CREATE TABLE Clubs (
Id INT PRIMARY KEY IDENTITY(1,1),
ClubName NVARCHAR(50) NOT NULL,
FoundingDate DATE NOT NULL,
CreatedAt DATETIME NOT NULL,
UpdatedAt DATETIME NOT NULL
);
CREATE TABLE Players (
Id INT PRIMARY KEY IDENTITY(1,1),
FirstName NVARCHAR(50) NOT NULL,
LastName NVARCHAR(50) NOT NULL,
PhoneNumber NVARCHAR(20) NOT NULL,
EmailAddress NVARCHAR(100) NOT NULL,
PersonalIdNumber NVARCHAR(50) NOT NULL,
PlayingPosition NVARCHAR(50) NOT NULL,
ClubId INT NOT NULL,
CreatedAt DATETIME NOT NULL,
UpdatedAt DATETIME NOT NULL,
CONSTRAINT FK_Players_Clubs FOREIGN KEY (ClubId)
REFERENCES Clubs (Id)
ON DELETE CASCADE
);
CREATE TABLE CoachingStaff (
Id INT PRIMARY KEY IDENTITY(1,1),
FirstName NVARCHAR(50) NOT NULL,
LastName NVARCHAR(50) NOT NULL,
PhoneNumber NVARCHAR(20) NOT NULL,
EmailAddress NVARCHAR(100) NOT NULL,
PersonalIdNumber NVARCHAR(20) NOT NULL,
Role NVARCHAR(50) NOT NULL,
ClubId INT NOT NULL,
CreatedAt DATETIME NOT NULL,
UpdatedAt DATETIME NOT NULL,
CONSTRAINT FK_CoachingStaff_Clubs FOREIGN KEY (ClubId)
REFERENCES Clubs (Id)
ON DELETE CASCADE
);