当前位置:网站首页>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 》
边栏推荐
- 【日常训练--腾讯精选50】89. 格雷编码(看题解才会的)
- "Grain mall" -- Summary and induction
- [daily training] 729 My schedule I
- Access Zadig self-test environment outside the cluster based on ingress controller (best practice)
- SQL common syntax records
- Interviewer: will concurrent programming practice meet? (detailed explanation of thread control operation)
- Opérations de lecture et d'écriture pour easyexcel
- Wood board ISO 5660-1 heat release rate mapping test
- What should I do to prepare for the interview algorithm position during school recruitment?
- selenium 获取dom内属性值的方法
猜你喜欢
Longest swing sequence [greedy practice]
显示屏DIN 4102-1 Class B1防火测试要求
How to prepare for the algorithm interview and answer the algorithm interview questions
Pytoch practice -- MNIST dataset handwritten digit recognition
Comprehensive optimization of event R & D workflow | Erda version 2.2 comes as "7"
Golang (1) | from environmental preparation to quick start
Enclosed please find. Net Maui's latest learning resources
MySQL InnoDB Architecture Principle
EasyExcel的讀寫操作
2022-07-03-cka- latest feedback from fans
随机推荐
驱动壳美国测试UL 2043 符合要求有哪些?
Why can't Chinese software companies produce products? Abandon the Internet after 00; Open source high-performance API gateway component of station B | weekly email exclusive to VIP members of Menon w
木板ISO 5660-1 热量释放速率摸底测试
Recursive query of multi-level menu data
[case] Application of positioning - Taobao rotation map
Objects in the list, sorted by a field
股票开户选择哪家证券公司比较好哪家平台更安全
显示屏DIN 4102-1 Class B1防火测试要求
Using webassembly to operate excel on the browser side
selenium 查找b或p标签的内容
Feng Tang's "spring breeze is not as good as you" digital collection, logged into xirang on July 8!
面试官:并发编程实战会吗?(线程控制操作详解)
R language [data management]
The transformation based on vertx web sstore redis to realize the distributed session of vertx HTTP application
leetcode:1755. Sum of subsequences closest to the target value
Zhang Lijun: penetrating uncertainty depends on four "invariants"
Parker driver maintenance COMPAX controller maintenance cpx0200h
Selenium finds the contents of B or P Tags
Access Zadig self-test environment outside the cluster based on ingress controller (best practice)
Learning notes of statistical learning methods -- Chapter 1 Introduction to statistical learning methods