相同的行
SELECT 默认显示所有的行,包括相同的行。
除去相同的行
在SELECT子句中用DISTINCT关键字除去相同的行
select distinct 列名 from 表名;
实例:
查询employees表,显示唯一的部门ID。
select distinct dept_id from employees;
SELECT 默认显示所有的行,包括相同的行。
除去相同的行
在SELECT子句中用DISTINCT关键字除去相同的行
select distinct 列名 from 表名;
实例:
查询employees表,显示唯一的部门ID。
select distinct dept_id from employees;