Author: Shameer
•10:37 AM
SQL - DISTINCT


The DISTINCT keyword can be used to return only distinct (different) values.

Main Table


1.   SELECT DISTINCT Customer_Name 
         FROM customer


2. SELECT DISTINCT Customer_Name FROM customer WHERE Cus_Id = 5


3.       SELECT DISTINCT Customer_Name 
             FROM customer 
     ORDER BY Customer_Name


4.       SELECT DISTINCT Customer_Name 
            FROM customer 
    ORDER BY Customer_Name DESC


5.     SELECT DISTINCT Customer_Name, Order_Date 
          FROM customer


6.     SELECT DISTINCT Customer_Name, Order_Date 
          FROM customer 
       WHERE Cus_Id = 4


7.         SELECT DISTINCT Customer_Name, Order_Date 
              FROM customer
      ORDER BY Customer_Name, Order_Date



8.        SELECT DISTINCT Customer_Name, Order_Date 
              FROM customer
      ORDER BY Customer_Name, Order_Date DESC



9.         SELECT DISTINCT Customer_Name, Order_Date 
              FROM customer
      ORDER BY Customer_Name DESC, Order_Date DESC