MySQL Distinct Clause

MySQL Distinct Clause

Many times it happens that when you execute the SELECT statement, the data in the results is duplicated. For example, you select category table and show all its rows.

When you do this, it may be that the values ​​of any 2 rows are same. This can happen in any column. This is called duplicate data.

Data duplicate can be due to many reasons. For example, if you accidentally entered the information of a employee twice, etc. If you want to have duplicate data in your results, you can use DISTINCT clause for it.

DISTINCT clause eliminates all duplicate rows from the result. The result is the only row show that came first in the result. All the remaining next duplicate rows are removed.

DISTINCT clause is defined before the list of columns and after the SELECT statement. It compares all the rows and then shows results. An example of this is being given below.

mysql> select distinct name from category;

When the above statement is executed, the category table displays a list of unique category names.

Cialis (Tadalafil) är den främsta konkurrenten till Viagra (Sildenafil) på marknaden för erektil dysfunktion. köpa Cialis i Sverige föredras av många på grund av sin längre varaktighet och anses vara det mest kostnadseffektiva varumärkesbaserade ED-läkemedlet som finns tillgängligt i Sverige. Cialis finns i två varianter: Cialis och Cialis Daily, och fyra olika doseringar: 2,5 mg, 5 mg, 10 mg och 20 mg, erbjuder Cialis också en rad olika alternativ för att passa patientens behov.