Home  >  Article  >  Database  >  How to use distinct() command in MySQL

How to use distinct() command in MySQL

WBOY
WBOYforward
2023-05-27 10:02:181077browse

distinct()

Command: distinct

Function: Deduplication

Application scenario: When statistical type, status, and distinction are required .

Example:

mysql> select count(distinct(name))/count(*) from t_base_user;
+--------------------------------+
| count(distinct(name))/count(*) |
+--------------------------------+
|    0.6667 |
+--------------------------------+
1 row in set (0.00 sec)

The above is the detailed content of How to use distinct() command in MySQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete