-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDDL_Project.sql
More file actions
48 lines (46 loc) · 1.33 KB
/
Copy pathDDL_Project.sql
File metadata and controls
48 lines (46 loc) · 1.33 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
38
39
40
41
42
43
44
45
46
47
48
create database trainingDB;
use trainingDB;
--table1: Trainee
create table Trainee(
trainee_id int primary key identity(1,1),
trainee_name varchar(100) not null,
gender varchar(10) check(gender in ('male','female')),
email varchar(50) unique not null,
background varchar(100)
)
--Table2: Trainer
create table Trainer(
trainer_id int primary key identity(1,1),
trainer_name varchar(100) not null,
specialty varchar(100),
phone varchar(11),
email varchar(50) unique not null
)
--Table3: Course
create table Course(
course_id int primary key identity(1,1),
title varchar(50) not null,
category varchar(50),
duration_hours int,
course_level varchar(20) check(course_level in ('Beginner', 'Intermediate', 'Advanced'))
)
--Table4: Schedule
create table Schedule(
schedule_id int primary key identity(1,1),
course_id int,
trainer_id int,
start_date date not null,
end_date date not null,
time_slot varchar(50) check(time_slot in ('Morning', 'Evening', 'Weekend')) ,
foreign key (course_id) references Course(course_id),
foreign key (trainer_id) references Trainer(trainer_id)
)
--Table5: Enrollment
create table Enrollment(
enrollment_id int primary key identity(1,1),
trainee_id int,
course_id int,
enrollment_date date,
foreign key (trainee_id) references Trainee(trainee_id),
foreign key (course_id) references Course(course_id)
)