import sqlite3

conn = sqlite3.connect('test.db')
cursor = conn.cursor()

# create table
cursor.execute('''CREATE TABLE test_table (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)''')

# insert data
cursor.execute("INSERT INTO test_table (name, age) VALUES ('John Doe', 25)")
cursor.execute("INSERT INTO test_table (name, age) VALUES ('Jane Smith', 30)")

# commit changes
conn.commit()

# close the connection
conn.close()

$ sqlite3 test.db SQLite version 3.31.1 2020-01-27 19:55:54 Enter ".help" for usage hints. sqlite> CREATE TABLE test_table (id INTEGER PRIMARY KEY, name TEXT, age INTEGER); sqlite> .tables test_table sqlite> .exit

from nump

$ sqlite3 test.db SQLite version 3.31.1 2020-01-27 19:55:54 Enter ".help" for usage hints. sqlite> INSERT INTO test_table (name, age) VALUES ('John Doe', 25); sqlite> INSERT INTO test_table (name, age) VALUES ('Jane Smith', 30); sqlite> SELECT * FROM test_table; 1|John Doe|25 2|Jane Smith|30

import sqlite3

#connect to the database (or create it if it doesn't exist)
conn = sqlite3.connect('example.db')

#create a table
conn.execute('''CREATE TABLE COMPANY
             (ID INT PRIMARY KEY     NOT NULL,
             NAME           TEXT    NOT NULL,
             AGE            INT     NOT NULL,
             ADDRESS        CHAR(50),
             SALARY         REAL);''')

#commit the changes and close the connection
conn.commit()
conn.close()