(2)DML 操作 data manage language 数据库管理语言
数据插入:
/*insert into t_student(id,名字,年龄,score) VALUES (1,'小明','pite',88.9);*/
insert into t_student(名字,score) VALUES ('小兰',90.8);
注意两点,一个是数据可以有中文,一个是数据插入的时候可以只插入部分数据。
更新数据:
update t_student set id = 2; 吧表中的所有id都改为2
删除数据:
delete from t_student;
这里是吧所有的表中的内容都删除掉。
create table if not exists t_student(id integer primary key autoincrement,名字 text,年龄 integer,score real);
insert into t_student(名字,score) VALUES ('小兰',90.8);
insert into t_student(名字,score) VALUES ('小兰',90.8);
主键约束:
比较关系可以是 = != is is not 以及逻辑关系 and or
(3)DQL 数据查询语句 最重要的
查询表中所有内容:SELECT * from t_student;
查询某一个属性
select 名字 from t_student;
条件查询语句:
select 名字,score FROM t_student where score > 95 and 年龄 < 17;