মূল কন্টেন্টে যান
eLearner.app
মডিউল 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 প্রচেষ্টার পরে উপলব্ধ