This repository has been archived by the owner on Jan 5, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathschoolMysSQL.sql
152 lines (140 loc) · 5.75 KB
/
schoolMysSQL.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
drop table Teach;
drop table Take;
drop table Teacher;
drop table Course;
drop table Student;
drop table Department;
create table Department
(did integer(5) not null,
dname varchar(30) not null,
comments varchar(50),
email varchar(30),
primary key(did));
create table Student
(sid integer(5) not null,
fname varchar(30) not null,
lname varchar(30),
birthdate date,
birthplace varchar(50),
did integer(5),
foreign key (did) references Department(did),
primary key(sid));
create table Course
(cid integer(5) not null,
title varchar(30) not null,
description varchar(50),
credits integer(2),
did integer(5),
foreign key (did) references Department(did),
primary key(cid));
create table Teacher
(tid integer(5) not null,
fname varchar(30) not null,
lname varchar(30),
birthdate date,
birthplace varchar(50),
did integer(5),
foreign key (did) references Department(did),
primary key(tid));
create table Take
(sid integer(5) not null,
cid integer(5) not null,
grade float,
foreign key (sid) references Student(sid),
foreign key (cid) references Course(cid),
primary key (sid,cid));
create table Teach
(tid integer(5) not null,
cid integer(5) not null,
foreign key (tid) references Teacher(tid),
foreign key (cid) references Course(cid),
primary key (tid,cid));
insert into Department values (1, 'Comp. Eng.', 'Computer Eng. Department', '[email protected]');
insert into Department values (2, 'Elec. Eng.', 'Electronic Eng. Department', '[email protected]');
insert into Department values (3, 'Env. Eng.', 'Environmental Eng. Department', '[email protected]');
insert into Department values (4, 'Ind. Eng.', 'Industrial Eng. Department', '[email protected]');
insert into Student values (1, 'Ali', 'Turan', '23-Jan-1980', 'istanbul', 1);
insert into Student values (2, 'Ahmet', 'buyuk', '2-Jul-1979', 'ankara', 1);
insert into Student values (3, 'Leyla', 'Sahin', '18-May-1982', 'izmir', 1);
insert into Student values (4, 'Can', 'Turkoglu', '6-Nov-1985', 'manisa', 2);
insert into Student values (5, 'Aziz', 'Keskin', '11-Dec-1978', 'istanbul', 2);
insert into Student values (6, 'Talat', 'Sanli', '12-Dec-1983', 'izmir', 3);
insert into Student values (7, 'Kamuran', 'Kece', '26-Sep-1980', 'adana', 3);
insert into Student values (8, 'Turgut', 'Cemal', '30-Oct-1977', 'bursa', 4);
insert into Student values (9, 'Oznur', 'Gunes', '1-Aug-1979', 'bolu', 2);
insert into Student values (10, 'Pelin', 'Tugay', '9-Mar-1980', 'izmir', 4);
insert into Student values (11, 'Savas', 'Tan', '9-Mar-1980', 'izmir', 4);
insert into Course values (1, 'database', 'CENG 351', 3, 1);
insert into Course values (2, 'operating system', 'CENG 341', 3, 1);
insert into Course values (3, 'Introduction to Programming', 'CENG 101', 4, 1);
insert into Course values (4, 'introduction to electronic', 'EE 101', 2, 2);
insert into Course values (5, 'statistic', 'IE 301', 4, 4);
insert into Course values (6, 'circuit theory', 'EE 202', 3, 2);
insert into Course values (7, 'introduction to environment', 'ENV 102', 3, 3);
insert into Course values (8, 'operation research', 'IE 208', 3, 4);
insert into Course values (9, 'summer practice', 'IE 299', 2, 4);
insert into Course values (10, 'summer practice', 'ENV 299', 3, 3);
insert into Course values (11, 'summer practice', 'CENG 299', 3, 1);
insert into Course values (12, 'summer practice', 'EE 299', 3, 2);
insert into Teacher values (1, 'Selami', 'Durgun', '10-Nov-1970', 'amasya', 1);
insert into Teacher values (2, 'Cengiz', 'Tahir', '21-Jul-1960', 'istanbul', 1);
insert into Teacher values (3, 'Derya', 'Seckin', '15-May-1962', 'mersin', 1);
insert into Teacher values (4, 'Dogan', 'Gedikli', '16-Nov-1965', 'istanbul', 2);
insert into Teacher values (5, 'Ayten', 'Kahraman', '11-Dec-1968', 'istanbul', 3);
insert into Teacher values (6, 'Tahsin', 'Ugur', '12-Dec-1963', 'izmir', 4);
insert into Teacher values (7, 'Selcuk', 'Ozan', '30-Oct-1960', 'amasya', 4);
insert into Teach values (1, 1);
insert into Teach values (3, 2);
insert into Teach values (2, 3);
insert into Teach values (4, 4);
insert into Teach values (7, 5);
insert into Teach values (4, 6);
insert into Teach values (5, 7);
insert into Teach values (6, 8);
insert into Teach values (7, 9);
insert into Teach values (5, 10);
insert into Teach values (1, 11);
insert into Teach values (4, 12);
insert into Take values (1, 1, 3);
insert into Take values (1, 3, 2.5);
insert into Take values (1, 4, 3.5);
insert into Take values (1, 6, 3);
insert into Take values (1, 9, 4);
insert into Take values (1, 10, 3);
insert into Take values (2, 1, 4);
insert into Take values (2, 2, 4);
insert into Take values (2, 3, 4);
insert into Take values (2, 4, 4);
insert into Take values (2, 5, 4);
insert into Take values (2, 6, 4);
insert into Take values (2, 7, 4);
insert into Take values (2, 8, 4);
insert into Take values (2, 9, 4);
insert into Take values (2, 10, 3);
insert into Take values (2, 11, 4);
insert into Take values (3, 1, 4);
insert into Take values (3, 2, 4);
insert into Take values (3, 3, 4);
insert into Take values (3, 4, 4);
insert into Take values (3, 5, 4);
insert into Take values (3, 6, 4);
insert into Take values (3, 7, 4);
insert into Take values (3, 8, 4);
insert into Take values (3, 9, 4);
insert into Take values (3, 10, 3);
insert into Take values (3, 11, 3.5);
insert into Take values (4, 1, 2.5);
insert into Take values (4, 5, 1.5);
insert into Take values (5, 11, 3.5);
insert into Take values (5, 1, 3);
insert into Take values (5, 5, 1.5);
insert into Take values (6, 2, 4);
insert into Take values (7, 5, 1.5);
insert into Take values (7, 1, 2.5);
insert into Take values (7, 8, 1.5);
insert into Take values (7, 2, 3);
insert into Take values (8, 2, 3.5);
insert into Take values (8, 7, 1.5);
insert into Take values (10, 2, 4);
insert into Take values (10, 8, 3);
insert into Take values (11, 8, 1);