-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUnoptimized_university_generation.dbs
295 lines (287 loc) · 13.4 KB
/
Unoptimized_university_generation.dbs
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<?xml version="1.0" encoding="UTF-8" ?>
<project name="Unoptimized_university.sql" id="Project-5e1" database="MySql" >
<schema name="university" >
<table name="course" generator_rows="100" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="Name" type="varchar" length="255" decimal="0" jt="12" mandatory="y" regexp="(Dairy|Beverages|Confections|Seafood|Meat|Poultry|Grain|Cereals|Produce|Shell fish|Snails)" />
<column name="Code" type="varchar" length="255" decimal="0" jt="12" mandatory="y" regexp="[A-Z]{3}[0-9]{3}-(19[7-9][0-9]|20[0-9]{2})" />
<column name="department_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<column name="professor_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<index name="pk_course" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
<index name="Code" unique="UNIQUE_KEY" >
<column name="Code" />
</index>
<index name="department_id" unique="NORMAL" >
<column name="department_id" />
</index>
<index name="professor_id" unique="NORMAL" >
<column name="professor_id" />
</index>
<fk name="course_ibfk_1" to_schema="university" to_table="department" delete_action="restrict" update_action="restrict" >
<fk_column name="department_id" pk="ID" />
</fk>
<fk name="course_ibfk_2" to_schema="university" to_table="professor" delete_action="restrict" update_action="restrict" >
<fk_column name="professor_id" pk="ID" />
</fk>
</table>
<table name="department" generator_rows="100" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="Name" type="varchar" length="255" decimal="0" jt="12" mandatory="y" regexp="list:file=businessSectors.txt" />
<index name="pk_department" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
</table>
<table name="final_exam" generator_rows="25000" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="grade_id" type="int" length="10" decimal="0" jt="4" />
<column name="course_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<column name="student_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<index name="pk_final_exam" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
<index name="course_id" unique="NORMAL" >
<column name="course_id" />
</index>
<index name="grade_id" unique="NORMAL" >
<column name="grade_id" />
</index>
<index name="student_id" unique="NORMAL" >
<column name="student_id" />
</index>
<fk name="final_exam_ibfk_2" to_schema="university" to_table="course" delete_action="restrict" update_action="restrict" >
<fk_column name="course_id" pk="ID" />
</fk>
<fk name="final_exam_ibfk_1" to_schema="university" to_table="grade" delete_action="restrict" update_action="restrict" >
<fk_column name="grade_id" pk="ID" />
</fk>
<fk name="final_exam_ibfk_2" to_schema="university" to_table="student" delete_action="restrict" update_action="restrict" >
<fk_column name="student_id" pk="ID" />
</fk>
</table>
<table name="grade" generator_rows="6" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="Name" type="enum" length="1" decimal="0" jt="12" mandatory="y" >
<enumeration><![CDATA['A','B','C','D','E','F']]></enumeration>
</column>
<index name="pk_grade" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
</table>
<table name="professor" generator_rows="10000" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="Name" type="varchar" length="255" decimal="0" jt="12" mandatory="y" />
<column name="Gender" type="enum" length="6" decimal="0" jt="12" mandatory="y" >
<enumeration><![CDATA['male','female']]></enumeration>
</column>
<column name="Salary" type="int" length="10" decimal="0" jt="4" mandatory="y" regexp="int:from=1000;to=10000;format=######.;" />
<column name="Date_of_Birth" type="date" length="10" decimal="0" jt="91" mandatory="y" regexp="date:from='01.01.1930';to='01.01.1995';" />
<column name="department_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<index name="pk_professor" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
<index name="department_id" unique="NORMAL" >
<column name="department_id" />
</index>
<fk name="professor_ibfk_1" to_schema="university" to_table="department" delete_action="restrict" update_action="restrict" >
<fk_column name="department_id" pk="ID" />
</fk>
</table>
<table name="professor_research" generator_rows="4000" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="research_project_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<column name="professor_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<index name="pk_professor_research" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
<index name="professor_id" unique="NORMAL" >
<column name="professor_id" />
</index>
<index name="research_project_id" unique="NORMAL" >
<column name="research_project_id" />
</index>
<fk name="professor_research_ibfk_2" to_schema="university" to_table="professor" delete_action="restrict" update_action="restrict" >
<fk_column name="professor_id" pk="ID" />
</fk>
<fk name="professor_research_ibfk_1" to_schema="university" to_table="research_project" delete_action="restrict" update_action="restrict" >
<fk_column name="research_project_id" pk="ID" />
</fk>
</table>
<table name="research_project" generator_rows="2000" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="Name" type="varchar" length="255" decimal="0" jt="12" mandatory="y" regexp="(Re|Ad|Par|Tru|Thru|In|Bar|Cip|Dop|End|Em|Fro|Gro|Hap|Kli|Lom|Mon|Qwi|Rap|Sup|Sur|Tip|Tup|Un|Up|Var|Win|Zee)(ban|cad|dud|dim|er|frop|glib|hup|jub|kil|mun|nip|peb|pick|quest|rob|sap|sip|tan|tin|tum|ven|wer|werp|zap)(il|ic|im|in|up|ad|ack|am|on|ep|ed|ef|eg|aqu|ef|edg|op|oll|omm|ew|an|ex|pl)?(icator|or|ar|ax|an|ex|istor|entor|antor|in|over|ower|azz)" />
<column name="Field" type="varchar" length="255" decimal="0" jt="12" mandatory="y" regexp="(Dairy|Beverages|Confections|Seafood|Meat|Poultry|Grain|Cereals|Produce|Shell fish|Snails)" />
<column name="Duration_in_Months" type="int" length="10" decimal="0" jt="4" mandatory="y" regexp="int:from=00;to=36;format=##;" />
<index name="pk_research_project" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
</table>
<table name="student" generator_rows="30000" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="Name" type="varchar" length="255" decimal="0" jt="12" mandatory="y" />
<column name="Phone_Number" type="varchar" length="255" decimal="0" jt="12" mandatory="y" />
<column name="Gender" type="enum" length="6" decimal="0" jt="12" mandatory="y" >
<enumeration><![CDATA['male','female']]></enumeration>
</column>
<column name="Date_of_Birth" type="date" length="10" decimal="0" jt="91" mandatory="y" regexp="date:from='01.01.1950';to='01.01.2003';" />
<column name="Street" type="varchar" length="255" decimal="0" jt="12" mandatory="y" regexp="([1-9][0-9][0-9]?) (North |East |West |South )(Green |White |Rocky )(Nobel|Fabien|Hague|Oak|Second|First|Cowley|Clarendon|New|Old|Milton) (Way|Street|St.|Avenue|Road|Parkway|Freeway|Drive|Boulevard|Blvd.)" />
<column name="City" type="varchar" length="255" decimal="0" jt="12" mandatory="y" />
<column name="Town" type="varchar" length="255" decimal="0" jt="12" mandatory="y" regexp="(AL|AK|AZ|AR|CA|CO|CT|DE|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY)-[A-Z]{2}" />
<column name="department_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<index name="pk_student" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
<index name="department_id" unique="NORMAL" >
<column name="department_id" />
</index>
<fk name="student_ibfk_1" to_schema="university" to_table="department" delete_action="restrict" update_action="restrict" >
<fk_column name="department_id" pk="ID" />
</fk>
</table>
<table name="student_course" generator_rows="25000" >
<column name="ID" type="int" length="10" decimal="0" jt="4" mandatory="y" >
<identity><![CDATA[AUTO_INCREMENT]]></identity>
</column>
<column name="student_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<column name="course_id" type="int" length="10" decimal="0" jt="4" mandatory="y" />
<index name="pk_student_course" unique="PRIMARY_KEY" >
<column name="ID" />
</index>
<index name="course_id" unique="NORMAL" >
<column name="course_id" />
</index>
<index name="student_id" unique="NORMAL" >
<column name="student_id" />
</index>
<fk name="student_course_ibfk_2" to_schema="university" to_table="course" delete_action="restrict" update_action="restrict" >
<fk_column name="course_id" pk="ID" />
</fk>
<fk name="student_course_ibfk_1" to_schema="university" to_table="student" delete_action="restrict" update_action="restrict" >
<fk_column name="student_id" pk="ID" />
</fk>
</table>
</schema>
<connector name="MySql" database="MySql" driver_class="com.mysql.jdbc.Driver" driver_jar="mysql-connector-java-8.0.23.jar" driver_desc="Standard" host="localhost" port="3306" user="root" passwd="cm9vdA==" />
<layout name="Parsed Script Layout" id="Layout-1478" show_relation="columns" >
<entity schema="university" name="course" color="3986C1" x="1296" y="240" />
<entity schema="university" name="department" color="3986C1" x="704" y="240" />
<entity schema="university" name="final_exam" color="3986C1" x="864" y="240" />
<entity schema="university" name="grade" color="3986C1" x="1024" y="240" />
<entity schema="university" name="professor" color="3986C1" x="1184" y="240" />
<entity schema="university" name="professor_research" color="3986C1" x="704" y="240" />
<entity schema="university" name="research_project" color="3986C1" x="928" y="240" />
<entity schema="university" name="student" color="3986C1" x="1152" y="240" />
<entity schema="university" name="student_course" color="3986C1" x="704" y="240" />
<callout x="48" y="48" pointer="Round" >
<comment><![CDATA[Current layout is generated by parsing the SQL script.
DbSchema is in 'offline' mode (not connected to any database).]]></comment>
</callout>
<script name="Unoptimized_university.sql" id="Editor-1665" language="SQL" >
<string><![CDATA[CREATE DATABASE University;
USE University;
CREATE TABLE Department
(
ID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE Professor
(
ID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Gender ENUM('male', 'female') NOT NULL,
Salary INT NOT NULL,
Date_of_Birth DATE NOT NULL,
department_id INT NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (department_id) REFERENCES Department(ID)
);
CREATE TABLE Research_Project
(
ID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Field VARCHAR(255) NOT NULL,
Duration_in_Months INT NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE Grade
(
ID INT NOT NULL AUTO_INCREMENT,
Name ENUM('A', 'B', 'C', 'D', 'E', 'F') NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE Professor_Research
(
ID INT NOT NULL AUTO_INCREMENT,
research_project_id INT NOT NULL,
professor_id INT NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (research_project_id) REFERENCES Research_Project(ID),
FOREIGN KEY (professor_id) REFERENCES Professor(ID)
);
CREATE TABLE Course
(
ID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Code VARCHAR(255) NOT NULL,
department_id INT NOT NULL,
professor_id INT NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (department_id) REFERENCES Department(ID),
FOREIGN KEY (professor_id) REFERENCES Professor(ID),
UNIQUE (Code)
);
CREATE TABLE Student
(
ID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(255) NOT NULL,
Phone_Number VARCHAR(255) NOT NULL,
Gender ENUM('male', 'female') NOT NULL,
Date_of_Birth DATE NOT NULL,
Street VARCHAR(255) NOT NULL,
City VARCHAR(255) NOT NULL,
Town VARCHAR(255) NOT NULL,
department_id INT NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (department_id) REFERENCES Department(ID)
);
CREATE TABLE Final_Exam
(
ID INT NOT NULL AUTO_INCREMENT,
grade_id INT,
course_id INT NOT NULL,
student_id INT NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (grade_id) REFERENCES Grade(ID),
FOREIGN KEY (student_id) REFERENCES Student(ID),
FOREIGN KEY (course_id) REFERENCES Course(ID)
);
CREATE TABLE Student_Course
(
ID INT NOT NULL AUTO_INCREMENT,
student_id INT NOT NULL,
course_id INT NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (student_id) REFERENCES Student(ID),
FOREIGN KEY (course_id) REFERENCES Course(ID)
);]]></string>
</script>
</layout>
</project>