0
What then is the difference between DISTINCT and the simple SELECT function ... Since they both show particular columns
4 odpowiedzi
+ 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.
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)
0
DISTINCT ..distinguishes reapeted data and return a single data.
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.