Sql distinct vs unique

This article is tagged with: Sql distinct vs unique and mysql

sql distinct vs unique

Unique: helps to ensure that all the values
in a column are different
Distinct: helps to remove all the duplicate
records when retrieving the records from a table.

how to get non distinct values in sql

SELECT [EmailAddress], [CustomerName] FROM [Customers] WHERE [EmailAddress] IN
(SELECT [EmailAddress] FROM [Customers] GROUP BY [EmailAddress] HAVING COUNT(*) > 1)

This article is tagged with: Sql distinct vs unique and mysql