[Python] SQL WITH PYTHON GIVING ERROR :- Column count doesn't match value count at row 1

Discussão em 'Python' iniciado por Stack, Agosto 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to run sql commands with python, but for some reason, its giving me error "Column count doesn't match value count at row 1". Tried everything but still didn't work. This is my code:-

    import mysql.connector

    mydb = mysql.connector.connect(host="localhost", user="root", passwd="###", database="student", auth_plugin="mysql_native_password")
    cursor = mydb.cursor()
    cursor.execute("insert into student(Rollno, Name, Class, marks) values(1,'carren','1B',100, 5,'john','2A',50)")

    Continue reading...

Compartilhe esta Página