Question: OperationalError Traceback ( most recent call last ) Cell In [ 8 0 ] , line 2 3 1 5 cur = conn.cursor ( )
OperationalError
Traceback most recent call last
Cell In line
cur conn.cursor
mathrm cur.executeCREATE TABLE IF NOT EXISTS employees
employeeid INTEGER PRIMARY KEY,
firstname TEXT,
cur.executemanyINSERT OR IGNORE INTO employees VALUES
'John', 'Doe', HR
'Jane', 'Smith', IT
'Mike', 'Brown', 'Finance',
'Emily', 'Davis', 'Marketing',
conn.commit
printemployees with a salary above :
OperationalError: table employees has columns but values were supplied
Dow below it is the full code
import sqlite
conn sqliteconnectcompanydb
cur conn.cursor
cur.executeCREATE TABLE IF NOT EXISTS employees
employeeid INTEGER PRIMARY KEY,
firstname TEXT,
lastname TEXT,
department TEXT,
salary REAL
cur.executemanyINSERT OR IGNORE INTO employees VALUES
'John', 'Doe', HR
'Jane', 'Smith', IT
'Mike', 'Brown', 'Finance',
'Emily', 'Davis', 'Marketing',
conn.commit
printemployees with a salary above :
cur.executeSELECT FROM employees WHERE salary
employeeswithhighsalary cur.fetchall
for row in employeeswithhighsalary:
printrow
cur.executeUPDATE employees SET salary WHERE employeeid
conn.commit
cur.executeDELETE FROM employees WHERE employeeid
conn.commit
print
Updated employees List:"
cur.executeSELECT FROM employees'
updatedemployees cur.fetchall
for row in updatedemployees:
printrow
conn.close
After the full code, I can't still see the issue on the code since I've tried to separate or find the missing columns, thank you.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
