↑ Return to General SQL Commands

Print this Page

SQL Distinct

How to use DISTINCT SQL function?

 

The SELECT keyword allows us to grab all information from a column (or columns) on a table. This, of course, necessarily mean that there will be redundancies. What if we only want to select each DISTINCT element? This is easy to accomplish in SQL. All we need to do is to add DISTINCT after SELECT. The syntax is as follows:

SELECT DISTINCT “column_name”
FROM “table_name”

Table tblsales

location Sales Date
Delhi 2500 Jan-05-1990
Noida 2250 Jan-07-1990
Bangalore 300 Jan-08-1990
Mumbai 1700 Jan-08-1990

Permanent link to this article: http://www.techxpress.in/general-sql-commands/sql-distinct/

Leave a Reply

Bookmark this page