-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSampleData.sql
More file actions
374 lines (297 loc) · 9.06 KB
/
SampleData.sql
File metadata and controls
374 lines (297 loc) · 9.06 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
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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
-- Script name: inserts.sql
-- Author: Amron Berhanu
-- Purpose: insert sample data to test the integrity of this database system
-- The database used for the inserts
USE CollegeDB;
-- AcademicLevel table inserts
INSERT INTO AcademicLevel (name) VALUES ("Freshman"),("Sophomore"),("Junior"),("Senior"),("Graduate");
-- AcademicStanding table inserts
INSERT INTO AcademicStanding (academic_standing_id, standing,min_GPA)
VALUES
(1, "Poor", 1.0), (2,"Good", 2.0),(3,"Excellent", 3.0);
-- Student table inserts
INSERT INTO Student (first_name, last_name, email, phone, standing, acadLevel)
VALUES
("Amron", "Berhanu", "amron@mail.com", "+123456789",2, 4),
("John", "Doe", "john@mail.com", "+123456789", 2, 5),
("Jane", "Doe", "jane@mail.com", "+123456789", 3, 3);
-- Staff table inserts
INSERT INTO Staff (first_name, last_name, email, phone)
VALUES
("Jose", "Ortiz", "jose@mail.com", "+123456123"),
("Arsene", "Wenger", "arsene@mail.com", "+123489235"),
("Mikel", "Arteta", "mikel@mail.com", "+123789253"),
("Arno", "Puder", "arno@mail.com", "+123456245"),
("Thomas", "John", "thomas@mail.com", "+123456213"),
("Kevin", "Boateng", "kevin@mail.com", "+123456098"),
("Fisher", "Price", "fisher@mail.com", "+123456567"),
("Martha", "Stewart", "martha@mail.com", "+123456243"),
("Andrew", "Jackson", "andrew@mail.com", "+123456789");
-- Department table inserts
INSERT INTO Department (name, phone)
VALUES
("Computer Science", "+4155151252"),
("Biology", "+4155151242"),
("Mathematics", "+4155151497"),
("History", "+4165651498");
-- Location table inserts
INSERT INTO Location (latitude, longitude) VALUES (23.292, 78.011),(-25.334, 83.204),(-21.989, 125.020);
-- Building table inserts
INSERT INTO Building (name, location)
VALUES
("Thornton Hall", 1),("Hensill Hall", NULL),("Burk Hall", 2);
-- Room table inserts
INSERT INTO Room (name,capacity,room_no,building)
VALUES
("Classroom", 50, 123, 1),("Classroom", 100, 3, 2),("Office", NULL, 24, 3),("Lab", 25, 99, 2);
-- Faculty table inserts
INSERT INTO Faculty (staff_id, role, office_phone, department, office)
VALUES
(1, "Professor", "+9876547321", 1, NULL),
(3, "Lecturer", "+9876547747", 2, NULL),
(4, "Chair", "+9876547678", 1, 3);
-- Administration table inserts
INSERT INTO Administration (staff_id, role, office_phone)
VALUES
(2, "Dean", "+9876547453"),
(5, "Provost", "+9876547790"),
(6, "Admissions", "+9876547126");
-- Finance table inserts
INSERT INTO Finance (staff_id, role, office_phone)
VALUES
(7, "Budget Director", "+9876547453"),
(8, "Financial Aid Officer", "+9876547790"),
(9, "Officer", "+9876547126");
-- Address table inserts
INSERT INTO Address (street_address, city, state, zipcode)
VALUES
("1 address st", "San Francisco", "CA", 94110),
("2 address st", "San Francisco", "CA", 94111),
("3 address st", "San Francisco", "CA", 94112),
("4 address st", "Oakland", "CA", 94601),
("5 address st", "Oakland", "CA", 94602),
("6 address st", "Oakland", "CA", 94603);
-- PaymentType table inserts
INSERT INTO PaymentType (address_id, description)
VALUES
(NULL, "descr1"),
(2, "descr2"),
(3, "descr3"),
(1, "descr4"),
(5, "descr5"),
(6, "descr6");
-- StudentPaymentInfo table inserts
INSERT INTO StudentPaymentInfo (student, paymentType)
VALUES
(1, 1),
(2, 2),
(3, 3);
-- StaffPaymentInfo table inserts
INSERT INTO StaffPaymentInfo (staff, paymentType)
VALUES
(1, 4),
(2, 5),
(3, 6);
-- BankAccount table inserts
INSERT INTO BankAccount (account_num, bank, routing, paymentType)
VALUES
(1, "Bank of America", "9876547453", 1),
(2, "Bank of America", "9876453888", 2),
(3, "Chase Bank", "9876547555", 3);
-- CreditCard table inserts
INSERT INTO CreditCard (card_num, bank, ccv, exp_date, paymentType)
VALUES
(1, "Bank of America", "987", CURDATE(), 4),
(2, "Bank of America", "645", CURDATE(), 5),
(3, "Chase Bank", "555",CURDATE(), 6);
-- StudentAddress table inserts
INSERT INTO StudentAddress (student, address)
VALUES
(1, 1),
(2, 2),
(3, 3);
-- StaffAddress table inserts
INSERT INTO StaffAddress (staff, address)
VALUES
(1, 4),
(2, 5),
(3, 6);
-- Major table inserts
INSERT INTO Major (name, type, department)
VALUES
("Computer Science", "Major", 1),
("Computer Science", "Minor", 1),
("Mathematics", "Major", 3);
-- CoreRequirements table inserts
INSERT INTO CoreRequirements (area, division, units_required)
VALUES
("Core Computer Science", "Lower", 22),
("Advanced Computer Science", "Upper", 12),
("Mathematics and Physics", "Lower", 22);
-- MajorRequirements table inserts
INSERT INTO MajorRequirements (major, requirement)
VALUES
(1, 1),
(1, 2),
(1, 3),
(2, 1),
(2, 3);
-- StudentMajors table inserts
INSERT INTO StudentMajors (student, major)
VALUES
(1, 1),
(2, 3),
(2, 2);
-- DegreeLevels table inserts
INSERT INTO DegreeLevel (level)
VALUES
("Bachelors"),("Masters"),("PhD");
-- Degree table inserts
INSERT INTO Degree (major, level)
VALUES
(1, 1),
(1, 2),
(3, 1);
-- Course table inserts
INSERT INTO Course (title, units, department)
VALUES
("Database Systems", 3, 1),
("Applied Linear Algebra", 3, 3),
("Calculus 3", 3, 3),
("Biology 100", 3, 2),
("Calculus 1", 3, 3),
("Bay Area History", 3, 4),
("Calculus 2", 3, 3),
("Intro to Programming", 3, 1);
-- GERequirements table inserts
INSERT INTO GERequirements (area, division, units_required)
VALUES
("Communication and Critical Thinking", "Lower", 9),
("Scientific Inquiry and Quantitative Reasoning", "Lower", 9),
("Arts and Humanities", "Lower", 9),
("Social Sciences", "Lower", 9),
("Arts and Humanities", "Lower", 9),
("Physical/Life Science", "Upper", 3),
("Arts and Humanities", "Upper", 3),
("Social Sciences", "Upper", 3);
-- CollegeRequirements table inserts
-- GERequirements table inserts
INSERT INTO CollegeRequirements (description, units_required)
VALUES
("SF State Studies", 12),
("Written English",9),
("U.S History and Government", 9);
-- CourseAttributes table inserts
INSERT INTO CourseAttributes (course_id, GEReq, coreReq, collegeReq)
VALUES
(1,NULL,2,NULL),
(5,2,3,NULL),
(6,8,NULL,1);
-- DegreeRequirements table inserts
INSERT INTO DegreeRequirements (degreeReq_id, degree_id, GE_id, core_req, college_req)
VALUES
(1,1,1,1,1),
(2,1,2,2,2),
(3,1,3,3,3),
(4,1,4,NULL,NULL);
-- Semesters table inserts
INSERT INTO Semesters (semester_id, semester, year)
VALUES
(1,"Fall", 2020),
(2,"Spring", 2021),
(3,"Summer", 2021);
-- Prerequisites table inserts
INSERT INTO Prerequisites (course_id, prereq,`condition`)
VALUES
(5,7,'C or Better'),
(7,3,'C or Better'),
(8,1,'C or Better');
-- Enrollment table inserts
-- [NEEDS PREREQUISITE DATA BEFOREHAND FOR TRIGGER TO WORK]
INSERT INTO Enrollment (student, course, semester)
VALUES
(1, 1, 1),
(1, 2, 2),
(2, 3, 3);
-- Sections table inserts
INSERT INTO Sections (course_id, title, type, instructor, room)
VALUES
(1, "Section 01", "Lecture", 1, NULL),
(4, "Section 03", "Lecture", 2, NULL),
(4, "Section 03", "Lab", 2, 4);
-- Timeslot table inserts
INSERT INTO Timeslot (start, end)
VALUES
(TIMESTAMP("2021-05-4", "12:30:00"), TIMESTAMP("2021-05-4", "13:45:00")),
(TIMESTAMP("2021-05-5", "14:00:00"), TIMESTAMP("2021-05-5", "15:15:00")),
(TIMESTAMP("2021-05-6", "19:00:00"), TIMESTAMP("2021-05-6", "21:45:00"));
-- WorkingDays itable nserts
INSERT INTO WorkingDays (day, description)
VALUES
('M', 'Monday'),
('T', 'Tuesday'),
('F', 'Friday');
-- ClassSchedule table inserts
INSERT INTO ClassSchedule (section, timeslot, day)
VALUES
(1,1,'M'), (2,2,'T'),(3,3,'F');
-- Transcripts table inserts
INSERT INTO Transcripts (units_taken, student_id, filepath)
VALUES
(30, 1, 'file1'),
(50, 2, 'file2'),
(10, 3, 'file3');
-- Honors table inserts
INSERT INTO Honors (honor_id, title, description)
VALUES
(1,"Deans List", NULL),
(2,"Cum Laude", "With distinction"),
(3,"Summa Cum Laude", "With the highest distinction");
-- HonorsStudents table inserts
INSERT INTO HonorsStudents (honor_id, student_id, award_date)
VALUES
(3,2,'2021-05-21'),
(1,1,'2021-05-30'),
(1,2,'2021-05-30');
-- Grants table inserts
INSERT INTO Grants (name,amount,provider)
VALUES
('Pell Grant', 5000, 'FAFSA'),
('University Grant', 1500, 'SFSU'),
('Subsidized Loan', 2000, 'FAFSA');
-- GrantRecipients table inserts
-- INSERT INTO GrantRecipients (student, grant, award_date)
INSERT INTO GrantRecipients (student,`grant`,award_date)
VALUES
(1,1,TIMESTAMP("2021-01-19", "12:30:00")),
(1,2,TIMESTAMP("2021-01-19", "12:30:00")),
(3,3,TIMESTAMP("2021-01-15", "12:30:00"));
-- Fees table inserts
INSERT INTO Fees (amount, description)
VALUES
(350.00, "Course Registration"),
(35.23, "Lab Materials"),
(250.50, "Access Code"),
(500.00, "Course enrollment"),
(100.00, "Gym membership");
-- CourseFees table inserts
INSERT INTO CourseFees (course, fee)
VALUES (4, 1), (4,2), (1,1);
-- StudentFees table inserts
INSERT INTO StudentFees (student, fee, date)
VALUES
(1, 4, TIMESTAMP("2020-12-03", "17:38:46")),
(1, 5, TIMESTAMP("2021-12-03", "17:38:48")),
(2, 4, TIMESTAMP("2021-12-19", "09:31:24"));
-- CourseBySemester table inserts
INSERT INTO CourseBySemester (course,semester)
VALUES
(1,1),(1,2),(1,3),
(2,2),
(4,1),(4,2),(4,3);
-- CourseEvaluations table inserts
INSERT INTO CourseEvaluations (course, faculty, filepath)
VALUES
(1,1,'eval1'),
(1,1,'eval2'),
(4,2,'eval1');