当前位置:网站首页>SQL knowledge leak detection
SQL knowledge leak detection
2022-07-05 21:28:00 【Raymond。】
sql Knowledge leak detection
Check the number of non null values in a column
Method 1:
select count( Name )
from Table name
where Name is not null;
Method 2:
select sum(case when Name is not null then 1 else 0 end)
from Table name ;
Method 3:
Focus on count() After the function , Find out
select count( Name )
from Table name ;
Return directly regardless null The number of .
Add sql count() function
# COUNT(column_name) Function returns the number of values for the specified column (NULL Not included in ):
SELECT COUNT(column_name) FROM table_name;
# COUNT(*) Function returns the number of records in the table , All records
SELECT COUNT(*) FROM table_name;
# COUNT(DISTINCT column_name) Function returns the number of different values for the specified column : notes :COUNT(DISTINCT) Apply to ORACLE and Microsoft SQL Server, But it can't be used for Microsoft Access.
SELECT COUNT(DISTINCT column_name) FROM table_name
sql Filter values in , be equal to , Greater than, etc
In a data analysis , You want to judge that the value of a column is equal to 0 when , Habitual writing :
select sum(case when Name == 0 then 1 else 0 end)
from Table name ;
After watching for a long time, I don't know what's wrong , So look for it sql Operators for filtering data :
Reference resources sql Judge equal _ Filtering data 《SQL Will know 》
边栏推荐
- Problems encountered in office--
- Get JS of the previous day (timestamp conversion)
- Two ways to realize video recording based on avfoundation
- 2022-07-03-cka- latest feedback from fans
- [case] Application of element display and hiding -- element mask
- Teach yourself to train pytorch model to Caffe (III)
- 力扣------经营摩天轮的最大利润
- Teach yourself to train pytorch model to Caffe (I)
- Binary search
- MySQL deep paging optimization with tens of millions of data, and online failure is rejected!
猜你喜欢
Uni app Bluetooth communication
How to prepare for the algorithm interview and answer the algorithm interview questions
Teach yourself to train pytorch model to Caffe (2)
MySQL deep paging optimization with tens of millions of data, and online failure is rejected!
【案例】元素的显示与隐藏的运用--元素遮罩
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
基于 Ingress Controller 在集群外访问 Zadig 自测环境(最佳实践)
冯唐“春风十里不如你”数字藏品,7月8日登录希壤!
Teach yourself to train pytorch model to Caffe (III)
"Grain mall" -- Summary and induction
随机推荐
Clickhouse copy paste multi line SQL statement error
基于 Ingress Controller 在集群外访问 Zadig 自测环境(最佳实践)
Postgres establish connection and delete records
Recursive query of multi-level menu data
Deep merge object deep copy of vant source code parsing
ESP32
Wood board ISO 5660-1 heat release rate mapping test
PVC 塑料片BS 476-6 火焰传播性能测定
Zhang Lijun: penetrating uncertainty depends on four "invariants"
vant 源码解析 event.ts 事件处理 全局函数 addEventListener详解
Deployment of Jenkins under win7
MySQL 千万数据量深分页优化, 拒绝线上故障!
Problems encountered in office--
Learning notes of SAS programming and data mining business case 19
思特奇加入openGauss开源社区,共同推动数据库产业生态发展
Pytorch实战——MNIST数据集手写数字识别
Get JS of the previous day (timestamp conversion)
PostGIS installation geographic information extension
秋招将临 如何准备算法面试、回答算法面试题
The reason why the ncnn converted model on raspberry pie 4B always crashes when called