1. -- 查询
    2. -- select * from table_name
    3. select * from score;
    4. -- 查询特定列的数据
    5. -- select 列名1,列名2 from table_name
    6. select user_name,score from score;
    7. -- 比较运算符
    8. -- 查询成绩 大于等于90
    9. select * from score where score >= 90;
    10. -- 查询成绩不等于100的用户名和成绩
    11. select user_name,score from score where score <> 100;
    12. select user_name,score from score where score != 100;
    13. -- 条件筛选
    14. -- 查询成绩大于等于90姓名等于王五的 and
    15. select * from score where score >= 90 and user_name = '王五';
    16. -- 查询 html成绩大于等于90的和查询sql成绩大于等于67 or
    17. select * from score where score >= 90 and subject = 'HTML';
    18. select * from score where score >= 67 and subject = 'sql';
    19. select * from score where (score >= 90 and subject = 'HTML') or (score >= 67 and subject = 'sql');
    20. -- 查询用户不是张三的 not
    21. select * from score where user_name != '张三';
    22. select * from score where not user_name != '张三';
    23. -- 查询 成绩80-90分之间的数据
    24. select * from score where score between 80 and 90;
    25. -- 查询成绩80-90之外的数据
    26. select * from score where score not between 80 and 90;
    27. -- 模糊查询
    28. -- % 任意字符
    29. -- 查询姓名以王开头
    30. select * from score where user_name like '王%';
    31. -- 中间带由麻的名字
    32. select * from score where user_name like '%麻%';
    33. -- 名字以三结尾
    34. select * from score where user_name like '%三';
    35. -- 查询名字是x三(张三 李三 王三)
    36. select * from score where user_name like '__三';
    37. select * from score where subject like 's_l';--sql
    38. -- null
    39. -- 查询性别为null的值
    40. select * from score where gender = null; -- 错误写法
    41. select * from score where gender is null;-- 使用is null
    42. -- 查询性别不为null
    43. select * from score where gender is not null;
    44. -- top前几个数据
    45. -- 查询前三条数据
    46. select top 3 * from score;
    47. -- 排序
    48. -- order by
    49. -- 成绩从大到小排列
    50. select * from score order by score desc;-- 按照成绩score 降序 desc
    51. -- 成绩从小到大排列
    52. select * from score order by score asc;
    53. -- 查询分数排名前三的学生
    54. select top 3 * from score order by score desc;
    55. select top 3 * from score order by score asc;