توضیحات

دستور Distinct برای حذف رکوردهای تکراری به کار می‌رود. این دستور فقط با Select می‌آید.

دستور

دستور Distinct در pl/sql به این شکل است:

SELECT DISTINCT expressions
FROM tables
[WHERE conditions];

 


مثال

• دستور Distinct با یک ستون:

SELECT DISTINCT state
FROM customers
WHERE last_name = 'Smith';

• دستورDistinct با بیش از یک ستون:

SELECT DISTINCT city, state
FROM customers
WHERE total_orders > 10
ORDER BY city;