'I can't create tables with sqlite3 - My table "exists" in sqlite, but it doesn't show up in my actual database [closed]

I'm creating a table called employees2, but I get the error "OperationalError: table employees2 already exists".

However, when I check in my actual database, there is no such table in my database.

import sqlite3

connection = sqlite3.connect('Stocks.db')

cursor = connection.cursor()
cursor.execute ('CREATE TABLE employees2 (name TEXT, surname TEXT, salary real)')

connection.commit()


Solution 1:[1]

CREATE TABLE has a IF NOT EXISTS clause precisely for this case:

https://www.sqlite.org/syntax/create-table-stmt.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Diego Torres Milano