SQL Select Distict Statement

In this tutorial, we will learn select distinct statement.

The DISTINCT keyword is used to return only distinct (different) values. The SELECT statement returns information from table columns. But what if we only want to select distinct elements? With SQL, all we need to do is to add a DISTINCT keyword to the SELECT statement: .

SELECT DISTINCT column_name(s) FROM table_name

ID Category Author Tutorial
1 PHP Hassan what is php
2 MySql James what is sql
3 Ajax Andrew what is ajax
4 ASP James ASP Introduction
5 C++ Andrew C++ Basics

Now we want to select only the distinct values from the column named "Author" from the table above.

select distinct(author) from tutorials

you will retrieve following result.

Author
Hassan
James
Andrew

Bookmark This Page

Link Partners