当前位置:Gxlcms > 数据库问题 > mysql sql语句修改某一字段下所有记录的大小写。

mysql sql语句修改某一字段下所有记录的大小写。

时间:2021-07-01 10:21:17 帮助过:12人阅读

-*- coding: utf-8 -*- import pymysql db = pymysql.connect( host=127.0.0.1, db=weixin, user="root", password="1233211234567Aa*", charset=utf8, ) cursor = db.cursor(pymysql.cursors.DictCursor)#字典的形式获取数据 不写默认是元组 try: cursor.execute("update plugin set name=lower(name)")#把表plugin下name字段下所有的值改为小写。UCASE()为大写 except Exception, e: print e try: cursor.execute("select name from plugin")#字典的形式获取数据 不写默认是元组 data=cursor.fetchall() for i in data: print i[name] except Exception, e: print e db.commit() cursor.close() db.close()

 

mysql sql语句修改某一字段下所有记录的大小写。

标签:大小写   数据   import   imp   exce   word   use   mys   ctc   

人气教程排行