GKsea.com image

Serving the world with Accurate GK and Current Affairs

Advertisements

Syntax of SQL SELECT DISTINCT Statement


SELECT DISTINCT Statement FORMAT
SELECT DISTINCT Statement is used when you want only distinct (different) values for a column or set of columns.

General syntax of SELECT DISTINCT statement

SELECT DISTINCT column_name,column_name FROM table_name;

Here replace the table_name with the name of table you want to retrieve data from. And column_name,column_name denotes names of the columns in your table for which you want their combination unique.

For Example: we have a table student in the database as below:

StudentIDStudentNameCityMobile
1001GautamJaipur9898988989
1002AliGoa9898988988
1003UpenMeerut9898988900
1004PuneetGoa9898988088
1005KarishmaMeerut9898958988
1006DimpiGoa9898988981
1007PreetamMeerut9898988985
1008SaurabhGoa9898988987
1009NishantGoa9898988986
1010SonaliDelhi9898988912
1010UmangDelhi989898894


Now if we write SELECT DISTINCT City FROM student;
Then Output will come as:
City
Jaipur
Goa
Meerut
Delhi

Previous Chapter|Next Chapter

Must Check


Advertisements

footer

Advertisements

Copyright© 2013-2015 Gksea.com. Powered by dataNcode | Disclaimer and Terms

Contact Us Mail Us