1)查看查询数据显示
SELECT * FORM student;
SELECE sname 姓名,sscore 分数 FROM student; /*只显示姓名,分数*/
SELECT * FROM student WHERE sscore<80;/*查询的基本条件> < <= >= != <> */
SELECT * FROM student WHERE sscore!=82 ;
SELECT * FROM student WHERE NOT sscore=82;
SELECT * FROM student WHERE sscore BETWEEN 70 AND 80;/*查询条件between and范围,可以在数字和日期类型划分*/
SELECT * FROM student WHERE sbirthday BETWEEN '1991-1-1' AND '2002-1-1';
-----基本条件like条件%
-----查询姓名是两个字学生信息
SELECT * FROM student WHERE sanem LIKE '__';/*_代表一个任意字符*/
SELECT * FROM student WHERE sname LIKE '%丽%'; /*%代表0个或多个任意字符*/
----基本条件in在某范围内,not in
SELECT * FROM student WHERE sno IN (201437,201445,201421)
SELECT * FROM student WHERE sname=' ';/*查询名字为空的学生信息*/
---基本条件null运算
SELECT * FROM student WHERE sscore IS NULL;
UPDATE student SET sscore=0 WHERE sscore IS NULL;/*将没有成绩的学生成绩改为0分*/
网友评论