sqlite3命令行下的常用命令
sqlite3命令行下的常用命令 1、sqlite3,或者sqilite3+.db,其中是数据库的名字,进入到sqlite互动模式。如果没有这个名字的数据库就创建一个新的数据库。 2、 .exit,退出sqlite互动模式的命令 3、 create table < table_name> (f1 type1,f2 type2,…); 创建新表 sqlite> create table peopleinfo
...> (_id integer primary key autoincrement,...> name text not null,...> age integer,...> height float);
sqlite>
4、.tables显示数据库中所有表名 5、drop table < table_name>删除表 6、.schema < table_name> 查看表的结构 7、.database 显示当前打开的数据库文件 8、insert into < table_name> values (value1,value2,…);向表中添加新记录 9、select * from < table_name>;查询表中所有记录 10、update < table_name> set < f1=value1>,< f2=value2>… where < expression>; 更新表中记录 sqlite> update peopleinfo set height=1.88 where name='Lily';
sqlite> select * from peopleinfo;
select * from peopleinfo;
1 Tom 21 1.81
2 Jim 22 1.78
3 Lily 19 1.68
4 Lucy 21 1.68
5 John 21 1.86
sqlite> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |