-- 查询-- select * from table_nameselect * from score;-- 查询特定列的数据-- select 列名1,列名2 from table_nameselect user_name,score from score;-- 比较运算符-- 查询成绩 大于等于90分select * from score where score >= 90;-- 查询成绩不等于100的用户名和成绩select user_name,score from score where score <> 100;select user_name,score from score where score != 100;-- 条件筛选-- 查询成绩大于等于90姓名等于王五的 andselect * from score where score >= 90 and user_name = '王五';-- 查询 html成绩大于等于90的和查询sql成绩大于等于67的 orselect * from score where score >= 90 and subject = 'HTML';select * from score where score >= 67 and subject = 'sql';select * from score where (score >= 90 and subject = 'HTML') or (score >= 67 and subject = 'sql');-- 查询用户不是张三的 notselect * from score where user_name != '张三';select * from score where not user_name != '张三';-- 查询 成绩80-90分之间的数据select * from score where score between 80 and 90;-- 查询成绩80-90之外的数据select * from score where score not between 80 and 90;-- 模糊查询-- % 任意字符-- 查询姓名以王开头select * from score where user_name like '王%';-- 中间带由麻的名字select * from score where user_name like '%麻%';-- 名字以三结尾select * from score where user_name like '%三';-- 查询名字是x三(张三 李三 王三)select * from score where user_name like '__三';select * from score where subject like 's_l';--sql-- null-- 查询性别为null的值select * from score where gender = null; -- 错误写法select * from score where gender is null;-- 使用is null-- 查询性别不为nullselect * from score where gender is not null;-- top前几个数据-- 查询前三条数据select top 3 * from score;-- 排序-- order by-- 成绩从大到小排列select * from score order by score desc;-- 按照成绩score 降序 desc-- 成绩从小到大排列select * from score order by score asc;-- 查询分数排名前三的学生select top 3 * from score order by score desc;select top 3 * from score order by score asc;