一.创建数据库
方法一:
1.sqlite3
进入数据库
2. .open test.db
创建数据库
3. .quit
退出数据库
方法二:
1.sqlite3 test.db
直接创建数据库
2. .databases
列出当前打开的数据库
3. .tables
查看表
二.创建表格
create table stu(id Integer,name char,score Integer);
三.插入一条记录
insert into stu values(2018001,'xiaoming',59);
" "和’'都可以
insert into stu(name,score) values('tlj',99);
插入部分字段内容
四.查看数据库的记录
select * from stu;
//查询所有字段
select name,score from stu;
//查询数据库中的部分字段
五.删除一条记录
delete from stu where id=1;
// where id=1相当于一个限制条件,也可以是其他
六.更改一条记录
update stu set name='hong' where id=1;
//将id号为1的记录中的
七.删除一张表
drop table stu;
八.增加一列
alter table stu add column sex char;