cd Desktop 进入桌面
sqlite3 testdb.sqlite 在桌面创建一个 testdb.sqlite
创建一个表
create table student ( number integer, name text , age integer);
create table if not exists stu_info(number integer primary key not null default 0, name text, gender text default '男');
显示表
.tables
�插入 一条数据
insert into student values (100,'洛洛',22);
查询 数据
select * from student;
改变显示模式
.mode line;
按条件查询
select * from student where age > 20 and number = 500; (混合查询)
按age升序
select *form student order by age asc;
按age降序
select *from student order by age desc;
更新数据
update student set age = 23 where number = 100;
删除数据
delete from student where name = 'haha'
更新
update student set age = 20, name = 'hhhh' where number = 100;
创建子表
create table if not exists child(mothername text, father text);
判断表里有几行记录
select count(*) from student;
退出
.quit
网友评论