sqlite3 的一些命令

1、创建打开数据库

sqlite3 arm.db  创建数据库arm.db

2、建立表

  create table table_name (col1_name type,col2_name type,col3_name type);

3、动态添加表字段

 alter table table_name add col_name type;

4、动态删除表字段

 例如:表test 中含有字段 id ,datatime ,record要删除record列

    create temporary table table_name (id integer primary key ,datatime int);

    insert into table_name select id ,datatime form test;或者insert into table_name select into *from test;

    drop table test;

   create table test (id integer primary key ,datatime int);

   insert into test select *form table_name;或者insert into test select id ,datatime formtable_name

 drop table table_name;

5、显示数据库中所有表的名称

select name from sqlite_master where type ='table' order by name;

6、显示数据库中所有表名中含有S02的名称

select name form sqlite_master where (type ='table' )and (name like 's02%');

7、插入数据

insert into table_name column_name values(值);

 8、修改某个字段的值

update table_name set column_name =值 where (条件);

附:

1、 sqlite3 sql命令必须依据;结尾来完成数据查询

2、sql下用于删除指定列 alter table table_name drop column col_name;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值