Python中數(shù)據(jù)庫(kù)的使用:
#進(jìn)入數(shù)據(jù)庫(kù)
#進(jìn)入文件夾
#查看
#退出文件夾
#關(guān)閉數(shù)據(jù)庫(kù)
數(shù)據(jù)庫(kù)的操作:
增:
sql = 'insert into 表名(列名1,列名2) values(%s,%s)'
params = ('要增加的列1內(nèi)容','要增加的列2內(nèi)容')
count = cur.execute(sql,params)
刪:
sql = 'delete from 表名 where 列名 = %s'
params = (要?jiǎng)h除的行對(duì)應(yīng)列內(nèi)容,)
recount = cur.execute(sql,params)
改:
sql = 'update 表名 set 列名2 = %s where 列名1 = %s'
params = ('對(duì)應(yīng)行的列名2下的內(nèi)容','要修改的行中含有的列內(nèi)容')
recount = cur.execute(sql,params)