The keyword DISTINCT at the beginning of the field list ensures that no duplicate rows appear in our result set. This is often very convenient when we are only interested in a few columns. For example, if we want to know which assignees (ASSIGNEE column) have a task in the TASKS table, we can easily determine this with :
SELECT DISTINCT assignee FROM tasks
But of course combinations can also be determined. If, for example, you want to determine which assignees are involved in which project, the following query will give you the 132 combinations that occur:
SELECT DISTINCT assignee, project FROM tasks
Without DISTINCT, the above query yields 1000 rows – one for each task in the table.