What then is the difference between DISTINCT and the simple SELECT function ... Since they both show particular columns | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What then is the difference between DISTINCT and the simple SELECT function ... Since they both show particular columns

1st Apr 2016, 6:36 AM
avarus
4 Answers
+ 1
Select query will fetch all records in the database including duplicate records if that table you are querying has such data. But distinct will not fetch the duplicate records. If the table does not have duplicate records then both are mostly identical.
22nd Jul 2016, 4:53 PM
Rajesh
Rajesh - avatar
0
If you use DISTINCT, the rows you get are not repeated. Let's say there are three people with the same name. If you write 'SELECT name FROM people' you will get the three columns with the same name. By doing 'SELECT DISTINCT name FROM people' you will get just one name (because the database don't show the repeated values)
8th May 2016, 2:45 PM
Andrés Rodríguez
Andrés Rodríguez - avatar
0
DISTINCT ..distinguishes reapeted data and return a single data.
28th Jun 2016, 1:35 PM
4xMafole
4xMafole - avatar
0
avarus♧♧ distinct avoid to show you the repeated information in your table. The table user consist of id,name,age for exemple. Names that exist in the user table:avarus,Aisha,john, avarus,amal,avarus. >>>Eg:select distinct name from user; User:the name of the table. Result:avarus,Aisha, John,amal. >>>eg:select name from user; Result:avarus,Aisha, John, avarus,amal,avarus. I wish that it is clear now.
11th May 2020, 8:47 PM
Amal Gil
Amal Gil - avatar