Создание БД

import sqlite3 con = sqlite3.connect('dosier.db') cur = con.cursor()

Создание таблицы

q = 'CREATE TABLE users(id integer PRIMARY KEY, name text)' cur.execute(q) con.commit()

Вставка данных

q = 'INSERT INTO users(id, name) VALUES(?, ?)' user = (1, 'Вася') cur.execute(q, user) con.commit()

Выборка данных

q = 'SELECT id, name FROM users' cur.execute(q) rows = cur.fetchall() for row in rows: print(row) q = 'SELECT id, name FROM users WHERE id > 10' cur.execute(q) rows = cur.fetchall() for row in rows: print(row)