#python3
#xiaodeng
#基于py3和pymysql查询某时间段的数据


import pymysql
conn=pymysql.connect(user='root',passwd='root',host='localhost',db='test.db')
cur=conn.cursor()


'''【核心语句】'''
cur.execute("select grage from 表名 where 时间字段 between '开始时间' and '结束时间'")
#eg:
#select grage from 表名 where 时间字段 between '2010-7-12 11:18:54' and '2010-7-12 11:22:20'


#用data接收需要返回的数据
data=cur.fethall()


#数据提取工作
for name,age in data:
    print(name,age)
    
conn.close()
cur.close()

 

相关文章:

  • 2021-09-25
  • 2022-01-13
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-01-28
  • 2021-12-03
相关资源
相似解决方案