python 在sql语句中使用%s,%d,%f

2022年12月30日09:26:36

python连接数据库执行增删查改

mysql数据库 import pymysql 

postgresql数据库 import psycopg2

普通含%的python语句

 

 

sql语句中

 

普通sql语句 select * from tables where tablename = 'table_name' ,所以这里该加的引号还是要加 

不加的情况

翻页的情况

 like的情况

因为普通sql语句是 where 列名 like '4301%' 这里需要多加一个%防止转义 

  • 作者:一小坨北北
  • 原文链接:https://blog.csdn.net/weixin_39331401/article/details/104476339
    更新时间:2022年12月30日09:26:36 ,共 216 字。