通过execute sql string关键字来执行对数据库的插入操作和删除操作。
(1)、向数据库中插入数据
connect to database using custom params | pymysql | database=‘world‘,user=‘root‘,password=‘root‘,host=‘localhost‘,port=3306 |
execute sql string |
insert into city(name,countrycode,district,population) values("beijing","zh","china","217100") |
|
disconnect from database |
(2)、从数据库中,删除数据
connect to database using custom params | pymysql | database=‘world‘,user=‘root‘,password=‘root‘,host=‘localhost‘,port=3306 |
execute sql string | delete from city where name = "beijing"; | |
disconnect from database |
原文地址:https://www.cnblogs.com/xiaobaibailongma/p/12250549.html
时间: 2024-10-12 06:31:06