cursor.execute(''' CREATE TABLE IF NOT EXISTS employees ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, age INTEGER, department TEXT ) ''') print("Table created successfully.")
cursor.execute("DELETE FROM employees WHERE name = 'Alice'") conn.commit() print("Record deleted successfully.")
# Step 4: Use ALTER to modify the table structure
try: cursor.execute("ALTER TABLE employees ADD COLUMN salary REAL") print("Table altered successfully.") except sqlite3.OperationalError as e: print("SQLite does not support adding columns with ALTER in some cases:", e)
# Step 5: Use DESCRIBE (SQLite alternative: PRAGMA table_info)
cursor.execute("PRAGMA table_info(employees)") columns = cursor.fetchall() print("Table structure:") for column in columns: print(column)