created: 2023-03-09 20:28:02
tags: [tools]
特殊命令
- .exit 退出
- .database 查询信息
- .table 查看表格
- .schema 查看结构
table
表操作
- 创建
create table person(id int, name text);
- 删除
drop table person;
数据操作
- 重命名
alter table person rename to student
- 插入
insert into student(id, name) values(1, '张三');
insert into student values(2, '李四');
- 修改
update student set name='王五' where id = 3;
- 删除
delete from student where name='王五';
- 查询
select * from student;
where
- in
where id in (1,2,3);
- and, or
where id = 1 and name = '张三'
where id = 1 or name = '张三'
- between and
where id between 1 and 3;
- like
where name = '张%'