For example, in the customers table, we have many rows whose state column has NULL values. MySQL Handling of GROUP BY”. The menu to the right displays the database, and will reflect any changes. We are going to use the below shown.
Example to get distinct values of a Column. In this example, we shall consider the following table data. For age column, there are two distinct values 10. For section column, there are three distinct values A, B, C. For gender column, there are two distinct values M, F. The return type of the COUNT() function is BIGINT.
The COUNT() function returns if there is no matching row found. If you are concerned with performance, only SELECT the columns you really need. DISTINCT for multiple columns is not supported. Result: There is now only one record that contains the value of Angela.
Therefore, we know that each row returned by our query will be distinct — it will contain a unique value. The following statement retrieves the salary data from the employees table and sorts it in descending order. If the SELECT clause contains more than one fiel the combination of values from all fields must be unique for a given record to be included in the. The distinct statement can be used with various aggregate functions, such as Count, Sum, and Average.
The result will be free from any duplicate entry.


.png.3f630543aead1e7dd2c224b754e4a0f1.png)