通过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 |