MySQL如何使用distinct()命令
更新:HHH   时间:2023-1-7


这篇文章将为大家详细讲解有关MySQL如何使用distinct()命令,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

distinct()

命令: distinct

作用:去重

应用场景:需要统计类型,状态,计算区分度时。

例子:

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

关于“MySQL如何使用distinct()命令”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

返回数据库教程...