The import module mport sqlite3 Connect to database onn = sqlite3.connect('test.db') Create cursors s = conn.cursor() Create table cs.execute('''CREATE TABLE student (id varchar(20) PRIMARY KEY, name varchar(20));''') close Cursor cs.close() Submit conn.commit() Close the connection conn.close() newly added cs.execute("INSERT INTO student (id, name) VALUES ('1', 'Jhon')") cs.execute("INSERT INTO student (id, name) VALUES ('2', 'Alan')") cs.close() conn.commit() conn.close() Inquire about cs.execute("SELECT id, name FROM student") data = cs.fetchall() print(data) cs.close() conn.close() modify cs.execute("SELECT id, name FROM student WHERE id = '1'") print(' Before the change -->', cs.fetchall()) cs.execute("UPDATE student set name = 'Nicolas' WHERE id = '1'") cs.execute("SELECT id, name FROM student WHERE id = '1'") print(' After modification -->', cs.fetchall()) conn.commit() cs.close() conn.close() Delete cs.execute("SELECT id, name FROM student") print(' Before deleting -->', cs.fetchall()) cs.execute("DELETE FROM student WHERE id = '1'") cs.execute("SELECT id, name FROM student") print(' After deleting -->', cs.fetchall()) conn.commit() cs.close() conn.close()