{student 是表名}
-- 插入数据
INSERT INTO student VALUES(1,'雄大','2019-07-15');
-- 插入指定数据
INSERT INTO student(pid,tname) VALUES(2,'兄弟');
-- 修改数据
UPDATE student SET pdate='1999-01-02',tname='123' WHERE pid=2;
-- 删除数据
DELETE FROM student WHERE pid=2;
-- 全表删除
DELETE FROM student; (带条件删除,不能删除约束)
TRUNCATE TABLE student; (不带条件删除,可以删除约束)
6 查询数据
1.全表查询
select * from student
2.查询指定字段数据
select name,id from student
3.查询时添加常量列
SELECT pid AS '编号',tname AS '姓名' FROM student;
4.查询时合并列
-- 查询本班的所有同学姓名及总成绩
SELECT sname,(html+js+jquery) AS 'grade' FROM score;
5.查询时去除重复列
select distinct sex from student
select distinct (sex) from student
6.条件查询
select * from student where name='李华'
7.查询成绩不等于20的同学
select * from sorce where grade<>20
8.查询成绩不合格的学生
select * from sorce where grade<60
9.查询成绩在30-80之间的学生
select * from sorce where grade<=80 and grade>=30
select * from sorce where grade between 30 and 80