当前位置:网站首页>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 》
边栏推荐
- 办公遇到的问题--
- XML modeling
- Enclosed please find. Net Maui's latest learning resources
- sql常用语法记录
- Selenium gets the verification code image in DOM
- SQL series (basic) - Chapter 2 limiting and sorting data
- PostGIS installation geographic information extension
- selenium 获取dom内验证码图片
- xlrd常见操作
- MySQL ifnull usage function
猜你喜欢

leetcode:1139. The largest square bounded by 1

事项研发工作流全面优化|Erda 2.2 版本如“七”而至

PVC plastic sheets BS 476-6 determination of flame propagation properties

MySQL 千万数据量深分页优化, 拒绝线上故障!

Alibaba cloud award winning experience: build a highly available system with polardb-x

Comprehensive optimization of event R & D workflow | Erda version 2.2 comes as "7"

MySQL deep paging optimization with tens of millions of data, and online failure is rejected!

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

MQ----activeMq

Parker driver maintenance COMPAX controller maintenance cpx0200h
随机推荐
Clion-MinGW编译后的exe文件添加ico图标
Recursive query of multi-level menu data
SYSTEMd resolved enable debug log
The reason why the ncnn converted model on raspberry pie 4B always crashes when called
Utils/index TS tool function
事项研发工作流全面优化|Erda 2.2 版本如“七”而至
Influence of oscilloscope probe on signal source impedance
MySQL deep paging optimization with tens of millions of data, and online failure is rejected!
校招期间 准备面试算法岗位 该怎么做?
JMeter installation under win7
xlrd常见操作
123456
Postgres establish connection and delete records
Get JS of the previous day (timestamp conversion)
int GetMonth( ) const throw( ); What does throw () mean?
AITM 2-0003 水平燃烧试验
Mode - "Richter replacement principle"
GCC9.5离线安装
Modifiers of attributes of TS public, private, protect
MQ----activeMq