SQL: Select distinct

For most real world tables, there will be repeated values similar to the table below.

IDartistealbumyear
1Rod StewartMaggie May1973
2New OrderSubstance1987
3NirvanaSmell Like Teen Spirit1992
4Rod StewartOut of Order1988

Using select count, we will have 4 records in the table.

However, we know that we only have 3 artistes in this table.  How do we correctly display the 3 artistes?  We use select distinct query statement.

SELECT DISTINCT column_name,column_name
FROM table_name;

select distinct artiste from artist

To count the unique artistes:

select count(distinct artiste) from artist
Series Navigation<< SQL: Retrieving filtered data from a table
SQL: More Select Examples >>