- 查询语法
SELECT select_list FROM table_source;
- DISTINCT 对查询结果集进行去重
SELECT DISTINCT select_list FROM table_source;
- TOP 查询表中前 n 行数据
SELECT TOP 行数 select_list FROM table_source;
示例演示
-- 查询表中所有结果
SELECT * FROM Student;
-- 查询 name
SELECT name FROM Student;
-- 查询去重后的 name
SELECT DISTINCT name FROM Student;
-- 查询前 3 条数据
SELECT TOP 3 * FROM Student;