What is DISTINCT and what is good for?

Experience Level: Junior
Tags: DatabasesMS SQL ServerQuality Assurance (QA)

Answer

DISTINCT keyword is used in conjunction with SELECT keyword to return unique values only instead of returning all values.

SELECT DISTINCT FirstName FROM Customers

The query above will return all unique first names from table Customers.

Related Databases job interview questions

Comments

No Comments Yet.
Be the first to tell us what you think.
MS SQL Server for Testers
MS SQL Server for Testers

Are you learning Databases ? Try our test we designed to help you progress faster.

Test yourself