Spaces:
Sleeping
Sleeping
Update database.py
Browse files- database.py +3 -3
database.py
CHANGED
|
@@ -152,8 +152,7 @@ def initialize_database():
|
|
| 152 |
|
| 153 |
# Clear existing data
|
| 154 |
cursor.execute("DELETE FROM student;")
|
| 155 |
-
|
| 156 |
-
cursor.execute("DELETE FROM course;")
|
| 157 |
|
| 158 |
# Insert 10 students
|
| 159 |
students = [
|
|
@@ -169,6 +168,7 @@ def initialize_database():
|
|
| 169 |
(10, "Julia", "Anderson", "1998-12-18", "julia@example.com", "8888888888", "Civil Engineering", 2016),
|
| 170 |
]
|
| 171 |
cursor.executemany("INSERT OR IGNORE INTO student VALUES (?, ?, ?, ?, ?, ?, ?, ?);", students)
|
|
|
|
| 172 |
|
| 173 |
# Insert 10 employees
|
| 174 |
employees = [
|
|
@@ -184,7 +184,7 @@ def initialize_database():
|
|
| 184 |
(10, "Vikram", "Reddy", "vikram@example.com", "ME", "Assistant Professor", 60000.00, "2017-11-03"),
|
| 185 |
]
|
| 186 |
cursor.executemany("INSERT OR IGNORE INTO employee VALUES (?, ?, ?, ?, ?, ?, ?, ?);", employees)
|
| 187 |
-
|
| 188 |
# Insert 10 courses (linked to instructors from employee table)
|
| 189 |
courses = [
|
| 190 |
(1, "Database Systems", "CS301", 1, "CSE", 4, "Fall"),
|
|
|
|
| 152 |
|
| 153 |
# Clear existing data
|
| 154 |
cursor.execute("DELETE FROM student;")
|
| 155 |
+
|
|
|
|
| 156 |
|
| 157 |
# Insert 10 students
|
| 158 |
students = [
|
|
|
|
| 168 |
(10, "Julia", "Anderson", "1998-12-18", "julia@example.com", "8888888888", "Civil Engineering", 2016),
|
| 169 |
]
|
| 170 |
cursor.executemany("INSERT OR IGNORE INTO student VALUES (?, ?, ?, ?, ?, ?, ?, ?);", students)
|
| 171 |
+
cursor.execute("DELETE FROM employee;")
|
| 172 |
|
| 173 |
# Insert 10 employees
|
| 174 |
employees = [
|
|
|
|
| 184 |
(10, "Vikram", "Reddy", "vikram@example.com", "ME", "Assistant Professor", 60000.00, "2017-11-03"),
|
| 185 |
]
|
| 186 |
cursor.executemany("INSERT OR IGNORE INTO employee VALUES (?, ?, ?, ?, ?, ?, ?, ?);", employees)
|
| 187 |
+
cursor.execute("DELETE FROM course;")
|
| 188 |
# Insert 10 courses (linked to instructors from employee table)
|
| 189 |
courses = [
|
| 190 |
(1, "Database Systems", "CS301", 1, "CSE", 4, "Fall"),
|