There are two ways to get unique values in the sample. Let there is a table tbl with a column name .
Grouping values
To group values, a GROUP BY is used, followed by a column name. A side effect of grouping is the fact that you only get the unique values of the grouped field.
SELECT name FROM tbl GROUP BY name
The main purpose of the GROUP BY obtain groups of records for applying aggregate functions, so purists often criticize this approach for obtaining unique values.
Explicit request for unique values
To query for unique values, you can specify the keyword DISTINCT in front of the column name
SELECT DISTINCT name FROM tbl