தொகுதி 2 · பாடம் 2 இன் 4பாடத்திட்டத்தில் 6/57~6 min
தொகுதி பாடங்கள் (2/4)
DISTINCT உடன் தனித்துவமான மதிப்புகள்
Sometimes a column contains repeated values and you only care about the
list of distinct values. The keyword DISTINCT placed right after
SELECT removes duplicates from the result:
SQL
SELECT DISTINCT <colonne>
FROM <tabella>
[WHERE <condizione>];Uniqueness is evaluated over the combination of all listed columns. If you list two columns, two rows are considered equal only when both values match.
Examples
SQL
-- Le città in cui abbiamo almeno un dipartimento:
SELECT DISTINCT city FROM departments;
-- Le coppie (dipartimento, città) presenti (qui ognuna unica):
SELECT DISTINCT department_id, hired_on
FROM employees;Try it
உடற்பயிற்சி#sql.m2.l2.e1
முயற்சிகள்: 0ஏற்றுகிறது…
List the distinct department_id values present among employees (duplicates must disappear).
எடிட்டரை ஏற்றுகிறது…
குறிப்பைக் காட்டு
Add DISTINCT right after SELECT to remove duplicates.
3 முயற்சிகளுக்குப் பிறகு தீர்வு கிடைக்கும்
Review exercise
உடற்பயிற்சி#sql.m2.l2.e2
முயற்சிகள்: 0ஏற்றுகிறது…
List the distinct (department_id, hired_on) pairs for employees hired from 2020 onwards.
எடிட்டரை ஏற்றுகிறது…
குறிப்பைக் காட்டு
DISTINCT evaluates uniqueness over the combination of all listed columns.
3 முயற்சிகளுக்குப் பிறகு தீர்வு கிடைக்கும்