Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL Tutorial -> Sql Distinct

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 366
    Comment on it

    <-- Chapter 3: SQL Select

    Chapter 4

    SQL District


    SQL District : District is a keyword which is used to fetch unique column values from database table OR we can simply say that ignores the column duplicate values. Syntax for district keyword is used below :-


    SELECT DISTINCT columnname 
    FROM tablename;
    

    Lets take an example, we have a database table "employees" below :-


    employee_id name code designation salary
    101 ABC E-101 Engineer 12000
    102 DEF E-102 Doctor 8000
    103 GHI E-103 Software Developer 8000
    104 JKL E-104 CEO 12000
    105 MNO E-105 Software Developer 100000

    Now we will use district keyword here to get employee records with unique salary.


    SELECT DISTINCT `salary`
    FROM `employees`;
    

    Now Run this Query, we will see the output below :-


    salary
    12000
    8000
    100000

    We can see the unique salary i.e unique column values in the above Output.


    Chapter 5: SQL Where -->

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: