当前位置:网站首页>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 》
边栏推荐
- EN 438-7建筑覆盖物装饰用层压板材产品—CE认证
- When a user logs in, there is often a real-time drop-down box. For example, entering an email will @qq com,@163. com,@sohu. com
- Explain various hot issues of Technology (SLB, redis, mysql, Kafka, Clickhouse) in detail from the architecture
- Which securities company is better and which platform is safer for stock account opening
- Sitge joined the opengauss open source community to jointly promote the ecological development of the database industry
- EasyExcel的讀寫操作
- Pytoch practice -- MNIST dataset handwritten digit recognition
- Using webassembly to operate excel on the browser side
- 第05章_存储引擎
- Evolution of zhenai microservice underlying framework from open source component encapsulation to self-development
猜你喜欢

Teach yourself to train pytorch model to Caffe (2)

Using webassembly to operate excel on the browser side

Chapter 05_ Storage engine

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

【案例】元素的显示与隐藏的运用--元素遮罩

Add ICO icon to clion MinGW compiled EXE file

Parker驱动器维修COMPAX控制器维修CPX0200H

冯唐“春风十里不如你”数字藏品,7月8日登录希壤!

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

秋招将临 如何准备算法面试、回答算法面试题
随机推荐
When a user logs in, there is often a real-time drop-down box. For example, entering an email will @qq com,@163. com,@sohu. com
Ethereum ETH的奖励机制
R语言【数据管理】
123456
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
Explain various hot issues of Technology (SLB, redis, mysql, Kafka, Clickhouse) in detail from the architecture
@Validated基础参数校验、分组参数验证和嵌套参数验证
思特奇加入openGauss开源社区,共同推动数据库产业生态发展
Enclosed please find. Net Maui's latest learning resources
字典树简单入门题(居然是蓝题?)
显示屏DIN 4102-1 Class B1防火测试要求
终端安全能力验证环境搭建和渗透测试记录
Aitm2-0002 12s or 60s vertical combustion test
秋招将临 如何准备算法面试、回答算法面试题
Simple getting started example of Web Service
The reason why the ncnn converted model on raspberry pie 4B always crashes when called
Teach yourself to train pytorch model to Caffe (III)
Deep merge object deep copy of vant source code parsing
Test of incombustibility of cement adhesives BS 476-4
Parker驱动器维修COMPAX控制器维修CPX0200H