当前位置:网站首页>Use the SQL SELECT count distinct query statement to count the total number of unique values of a field in the database
Use the SQL SELECT count distinct query statement to count the total number of unique values of a field in the database
2022-06-28 06:01:00 【Cross border kicking】
If you want to count the total number of unique value contents that are not repeated in one or several fields in the database , For example, from the database “ Customer information ” Li statistics “ Address table ” Inside “ City ” How many cities are there in the field , You can use the following statement :
SELECT COUNT(DISTINCT City ) FROM Customer information . Address table
there COUNT Indicates the total number of rows of statistical query results , and DISTINCT Represents a statistically unique value , That is to say, remove the duplicate values in the query results , This query statement returns a number .
This statement can be followed by WHERE Perform conditional filtration , for instance :
SELECT COUNT(DISTINCT City ) FROM Customer information . Address table WHERE Province =' guangdong '
边栏推荐
- How to add live chat in your Shopify store?
- Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException:异常解决
- Data middle office: six questions data middle office
- 简单手写debounce函数
- 联想混合云Lenovo xCloud,新企业IT服务门户
- YYGH-7-用户管理
- Data warehouse: financial / banking theme layer division scheme
- idea创建类时自动添加注释
- 容量调度绝对值配置队列使用与避坑
- Scripting and programming languages
猜你喜欢

Sklearn Feature Engineering (summary)

mac下安装多个版本php并且进行管理

Mysql-17- create and manage tables

Filecoin黑客松开发者大赛

What is the e-commerce conversion rate so abstract?

开发者的时代红利在哪里?

深度学习19种损失函数

基于Kotlin+JetPack实现的MVVM框架的示例

6. graduation design temperature and humidity monitoring system (esp8266 + DHT11 +oled real-time upload temperature and humidity data to the public network server and display the real-time temperature

移动广告发展动向:撬动存量,精细营销
随机推荐
Data warehouse: financial / banking theme layer division scheme
Differences between overloads, rewrites, abstract classes and interfaces
Cryptography notes
【无标题】
Global country (and region) information JSON data
Data middle office: construction ideas and implementation experience of data governance
6. graduation design temperature and humidity monitoring system (esp8266 + DHT11 +oled real-time upload temperature and humidity data to the public network server and display the real-time temperature
YYGH-6-微信登录
pytorch dataloader的长度 epoch与iteration的区别
File foundation - read / write, storage
Important basis for ERP software company selection
Mysql-17- create and manage tables
death_satan/hyperf-validate
YYGH-8-预约挂号
Working principle of es9023 audio decoding chip
Lombok @equalsandhashcode annotation how to make objects The equals () method compares only some attributes
Ethereum Classic的难度计算|猿创征文
Jenkins继续集成2
numpy. reshape, numpy. Understanding of transfer
Where is the era bonus for developers?