I am following a online learning course line by line but I somehow got this error. What can I change in order to have the result complete?
sample data
classroom_data =[( 1, “Raj”,“m”, 70, 84, 92),
( 2, “Poonam”, “F”, 87, 69, 93),
( 3, “Nik”, “M”, 65, 83, 90),
( 4, “Rahul”,“F”, 83, 76, 89)]
open connection
connection = sqlite3.connect(“classroomDB.db”)
open cursor
cursor = connection.cursor()
insert each student record
for student in classroom_data:
# formatted query string
insert_statement = “”“INSERT INTO classroom
(student_id, name, gender, physics_marks, chemistry_marks, mathematics_marks)
VALUES
({0}, “{1}”, “{2}”, {3}, {4}, {5});”“”.format(student[0], student[1], student[2],
student[3],student[4], student[5])
# execute insert query
cursor.execute(insert_statement)
commit the changes
connection.commit()
close the connection
connection.close()
RESULT:
OperationalError Traceback (most recent call last)
Cell In [18], line 20
14 insert_statement = “”“INSERT INTO classroom
15 (student_id, name, gender, physics_marks, chemistry_marks, mathematics_marks)
16 VALUES
17 ({0}, “{1}”, “{2}”, {3}, {4}, {5});”“”.format(student[0], student[1], student[2],
18 student[3],student[4], student[5])
19 # execute insert query
—> 20 cursor.execute(insert_statement)
22 # commit the changes
23 connection.commit()
OperationalError: table classroom has no column named chemistry_marks