结构化查询语言SQL
2022-09-29 09:22:54
关系型数据库
增
sql = "INSERT INTO user (username, password) VALUES (%s, %s)"
cursor.execute(sql, ['jack', '123456'])
connection.commit()
删
DELETE FROM book WHERE id = 1
查
sql = "SELECT * FROM user order by id desc limit 3"
cursor.execute(sql)
result = cursor.fetchall()
改
UPDATE book SET price = 45 WHERE id = 1