SELECT name,age FROM students ORDER BY age:
查询 student表的name,age并且age按降序排列(默认升序)
SELECT name,age FROM students ORDER BY age DESC:
查询 student表的name,age并且age按降序排列
SELECT name,age FROM students ORDER BY age DESC,name:
查询 student表的name,age并且age按降序排列 名字也按升序排列
SELECT name,age FROM students ORDER BY age LIMIT 3;
查询 student表的name,age并且age按降序排列 显示前三个
SELECT name,age FROM students ORDER BY age ASC;
查询 student表的name,age并且age升序序排列
SELECT name,age FROM students WHERE age = 17:
查询 student表的name,age条件是age=17
select name,age from students where age = 18 or age = 19 ;
只有18 19的人
SELECT Name,age from students WHere age not in (18,19);
不在18 19 的 全部返回
select name,age,height from students where (height = 170 or height = 180) and age <= 19 ;
返回170 180 并且年龄 大于等于19
select * from students where height = null ;
返回身高等于null的
select name,age,birthday from students where birthday BETWEEN "1997/6/1" and "1997/12/31";
返回这个日期之间的值
SELECT name,age FROM students where age <> 18;
返回年龄不等于18的
SELECT name,age from students where age != 18
返回年龄不等于18的
= != < > <= =>
等于 不等于 小于 大于 小于等于 大于等于