Error in inserting table in column

Great! You formatted the post correctly. You can probably see for yourself that indentation is not lost anymore and parts of the text are not replaced by something else anymore. I think that with your current rights you have a limited time to edit your posts in this forum.

About the code

Note that everything essential was said already at the beginning of our communication so I will try to explain it in different words and more details.

connection = sqlite3.connect("classroomDB.db")

Using this command you are opening an SQLite database stored in a file named classroomDB.db.

    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])

Here you construct the SQL query which will be used to insert a new row into the database table classroom which is in the opened database file classroomDB.db. Notice that you are not creating any databases, tables or columns in this program. You are using a database which already existed before the program was executed.

Also notice that here in this SQL query you are referring to a column named chemistry_marks.

Also as I noted earlier: this way (using format()) of inserting parameter values into an SQL query is really wrong - it is dangerous! If the course does not explain this for you I would stay away from it. Link to how to do this correctly is in my earlier post.

    cursor.execute(insert_statement)

Here you execute the constructed SQL query. The error shows up as an exception coming from this statement after you execute the notebook cell. See below:

OperationalError: table classroom has no column named chemistry_marks

This is the exception message which explains to you that while you were operating with the table classroom you referred to a column named chemistry_marks but this column does not exist in the table.

Conclusion

You are using an existing database file named classroomDB.db. Your program is written so that it expects that the database contains a table named classroom which contains a column named chemistry_marks. The column does not exist there so the program exits with the error.

I asked you about these earlier already:

  • Where does the database file classroomDB.db come from?
    • Did you create the file or did you get it somehow?
  • Did not you need to do some operations with the file before doing this task?
    • Did not you skip some exercise(s)?
  • Or does not the column have a different name?

Answering these questions is essential for finding the cause of the problem.