0%

Mysql Basis

关键字

distinct

1
2
3
4
5
6
SELECT DISTINCT(gender) FROM employees;

gender
--------
M
F

但是以下情况失效。这时适合用group by

1
2
SELECT DISTINCT(gender), emp_no FROM employees;
SELECT gender, emp_no FROM employees GROUP BY gender;