当前位置:网站首页>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 》
边栏推荐
- Mode - "Richter replacement principle"
- Talk about my fate with some programming languages
- Haas506 2.0 development tutorial - Alibaba cloud OTA - PAC firmware upgrade (only supports versions above 2.2)
- Vant source code parsing event Detailed explanation of TS event processing global function addeventlistener
- vant 源码解析之 utils/index.ts 工具函数
- Establishment of terminal security capability verification environment and penetration test records
- Is it necessary for bazel to learn
- POJ 3414 pots (bfs+ clues)
- MQ----activeMq
- 100 cases of shell programming
猜你喜欢

"Grain mall" -- Summary and induction

递归查询多级菜单数据

Wood board ISO 5660-1 heat release rate mapping test

ArcGIS\QGIS无插件加载(无偏移)MapBox高清影像图

How to prepare for the algorithm interview and answer the algorithm interview questions

2022-07-03-CKA-粉丝反馈最新情况

Simple interest mode - evil Chinese style

LeetCode_哈希表_困难_149. 直线上最多的点数

Realize the function of verifying whether the user has completed login when browsing the page

Teach yourself to train pytorch model to Caffe (2)
随机推荐
Is Kai Niu 2980 useful? Is it safe to open an account
Simple interest mode - lazy type
R language [data management]
Which securities company is better and which platform is safer for stock account opening
Display DIN 4102-1 Class B1 fire test requirements
Binary search
驱动壳美国测试UL 2043 符合要求有哪些?
Aitm2-0002 12s or 60s vertical combustion test
Vant source code parsing event Detailed explanation of TS event processing global function addeventlistener
LeetCode_哈希表_困难_149. 直线上最多的点数
Comparison table of foreign lead American abbreviations
EasyExcel的读写操作
Simple getting started example of Web Service
POJ 3414 pots (bfs+ clues)
Generics of TS
What should I do to prepare for the interview algorithm position during school recruitment?
CLion配置visual studio(msvc)和JOM多核编译
Cross end solution to improve development efficiency rapidly
Golang (1) | from environmental preparation to quick start
[daily training] 729 My schedule I