一、学习的知识点
1 数据库的字段类型
char(6):访问效率更高,占用空间更大
varchar(6):访问效率低,空间为存入的数据长度加1,内存利用率更高
integer:可以存放整型数据,可以实现自增,自增关键字:autoincrement;id integer autoincrement,对应的values填null
text:类似于string
2 sql常用操作
- create
- insert into 数据文件名 (字段名) values(数据);字段不建议省略,因为后期如果字段有更新时,添加过的数据有问题。
- drop table 表名;删除表
- alter table 表名 add 字段名;alter table tbluser add age int;
- .ta 查看表
- select * from 表名;查看表数据
- .schema 表名;查看表结构
- delete from 表名;删除表数据
- update 表名 set 字段名=更新值 where 字段名=值;精确查找+查询
- select * from 表名 where 字段名 》= 90;范围查询
- 交并补:and or
- select * from score limit 3,7;偏移三条数据后显示7条数据
- default 0:指定非空默认值为0,插入时的values填null ,或者对应的字段名不写 subscore integer default 0
- select * from score limit 3*(i-1),7;
- .read ***.sql;读取.sql脚本创建及写入数据
二、上课没有听懂或者没有理解的地方
无
三、当天学习的收获
学会了通过脚本创建数据表及写入数据