当前位置:网站首页>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 》
边栏推荐
- Clion configures Visual Studio (MSVC) and JOM multi-core compilation
- Talk about my fate with some programming languages
- Teach yourself to train pytorch model to Caffe (III)
- LeetCode_ Hash table_ Difficulties_ 149. Maximum number of points on the line
- [case] Application of element display and hiding -- element mask
- Simple interest mode - evil Chinese style
- Recursive query of multi-level menu data
- MySQL 千万数据量深分页优化, 拒绝线上故障!
- selenium 获取dom内验证码图片
- vant 源码解析 event.ts 事件处理 全局函数 addEventListener详解
猜你喜欢
How to prepare for the algorithm interview and answer the algorithm interview questions
Xlrd common operations
[case] Application of positioning - Taobao rotation map
校招期间 准备面试算法岗位 该怎么做?
Parker driver maintenance COMPAX controller maintenance cpx0200h
Recursive query of multi-level menu data
Teach yourself to train pytorch model to Caffe (III)
Parker驱动器维修COMPAX控制器维修CPX0200H
leetcode:1139. The largest square bounded by 1
Learning robots have no way to start? Let me show you the current hot research directions of robots
随机推荐
postgis 安装地理信息扩展
Chapter 05_ Storage engine
2022-07-03-cka- latest feedback from fans
Interviewer: will concurrent programming practice meet? (detailed explanation of thread control operation)
[case] Application of element display and hiding -- element mask
AITM2-0002 12s或60s垂直燃烧试验
How to send samples when applying for BS 476-7 display? Is it the same as the display??
Sitge joined the opengauss open source community to jointly promote the ecological development of the database industry
Two ways to realize video recording based on avfoundation
selenium 查找b或p标签的内容
面试官:并发编程实战会吗?(线程控制操作详解)
办公遇到的问题--
五层网络协议
ESP32
leetcode:1139. The largest square bounded by 1
第05章_存储引擎
显示器要申请BS 476-7 怎么送样?跟显示屏一样吗??
Binary search
Some things make feelings nowhere to put
What should I do to prepare for the interview algorithm position during school recruitment?