当前位置:网站首页>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 》
边栏推荐
- Chapter 05_ Storage engine
- Hdu2377bus pass (build more complex diagram +spfa)
- Simple getting started example of Web Service
- MySQL InnoDB Architecture Principle
- [daily training] 729 My schedule I
- one hundred and twenty-three thousand four hundred and fifty-six
- ArcGIS\QGIS无插件加载(无偏移)MapBox高清影像图
- Sequence alignment
- Dictionary tree simple introductory question (actually blue question?)
- CLion配置visual studio(msvc)和JOM多核编译
猜你喜欢

leetcode:1139. The largest square bounded by 1

What should I do to prepare for the interview algorithm position during school recruitment?

ArcGIS栅格重采样方法介绍

Making global exception handling classes with aspect

木板ISO 5660-1 热量释放速率摸底测试
![[case] Application of element display and hiding -- element mask](/img/6e/6ea484a6e5d547e01dd8820af8e314.png)
[case] Application of element display and hiding -- element mask

Display DIN 4102-1 Class B1 fire test requirements

uni-app 蓝牙通信

Introduction of ArcGIS grid resampling method

Golang(1)|从环境准备到快速上手
随机推荐
Selenium gets the verification code image in DOM
Comparison table of foreign lead American abbreviations
Pytorch实战——MNIST数据集手写数字识别
办公遇到的问题--
Cross end solution to improve development efficiency rapidly
Utils/index TS tool function
SQL common syntax records
@Validated basic parameter verification, grouping parameter verification and nested parameter verification
Enclosed please find. Net Maui's latest learning resources
MySQL InnoDB Architecture Principle
Sophomore personal development summary
Add ICO icon to clion MinGW compiled EXE file
浅聊我和一些编程语言的缘分
Access Zadig self-test environment outside the cluster based on ingress controller (best practice)
基于 Ingress Controller 在集群外访问 Zadig 自测环境(最佳实践)
Opérations de lecture et d'écriture pour easyexcel
Golang (1) | from environmental preparation to quick start
Five layer network protocol
Modifiers of attributes of TS public, private, protect
字典树简单入门题(居然是蓝题?)