python sqlite操作

1、sqlite 中指令操作

删除db中某一个table:

 delete from column_data where table_name="table1"or table_name= "table2"
 2、对一个table重命名
coon.execute("ALTER TABLE tablename1 RENAME TO tablename2")

3、选取其中的元素

cursor = c.execute("SELECT id  from tablename")//选取其中一个元素
cursor = c.execute("SELECT *  from tablename ")//选取全部的元素,这个包括index,对这个tuple操作不是特别方便

4、向table中插入数据

c2.execute("insert into table values (?,?,?,?,?,?,?,?)", (row[0],row[1],row[2],row[3],row[4],row[5],row[6],row[7]))

 

 

 

 
 
 
posted @ 2017-09-15 15:16  Create-Heart  阅读(469)  评论(0编辑  收藏  举报