python 怎么在字符串中使用变量?
我有一条SQL语句,想把里面的年月日改成变量应该怎么写
select * from usb where time between to_date('2012-04-06 00:00:00','YYYY-MM-DD HH24:MI:SS') and to_date('2012-04-06 23:59:59','YYYY-MM-DD HH24:MI:SS')
1. 使用连接符: +
world = "World"2. 使用占位符来内插
3. 使用函数
上面的语句中字符串是作为参数传入的,可以直接用变量替换:
begin_date = '2012-04-06 00:00:00'