SQL Distinct Command

In this chapter you will learn:
Distinct command
Syntax of this command
Example of distinct command

Distinct command

Distinct command is used to retrieve the different or distinct data from the table used with the help of select command. If you have a record in which some data are same such as some name of the employee or city are same then you can use distinct command to only display the different data.

Syntax of distinct command:-

1. Select distinct column_name from table_name
2. Select distinct column_name1, column_name2…….. from table_name

Example of distinct command

select distinct contactid from humanresources.employee

image of distinct command
SUMMARY
In this chapter, you have learned about distinct command with the example so now you can use this command to retrieve different data so try it yourself. In the next chapter you will learn about where command.
 

Share your thought