当前位置:网站首页>Oracle null 有哪些注意事项【面试题】
Oracle null 有哪些注意事项【面试题】
2022-08-03 05:22:00 【鱼丸丶粗面】
1 概述
null:空值,未指定的、未知的 或 不可预知的值。
2 示例
2.1 运算
select 1 + null 加,
1 - null 减,
1 * null 乘,
1 / null 除
from dual;
-- 结果都是 null
2.2 判断
with t_test as (
select null a from dual union all
select 1 a from dual
)
select t.*
from t_test t
where t.a is not null;
-- 返回 1
2.3 统计
with t_test as (
select null a from dual union all
select 1 a from dual union all
select 1 a from dual
)
select count(1) a, -- 3
count(*) b, -- 3
count(t.a) c, -- 2
count(distinct t.a) d -- 1
from t_test t;
2.4 子查询
with t_test as (
select null a from dual union all
select 1 a from dual union all
select 1 a from dual
)
select t.a
from t_test t
where t.a not in (null, 2);
-- 返回 null
2.5 连接
select 'a' || null a -- a
from dual;
2.6 排序
边栏推荐
猜你喜欢
随机推荐
自定义封装组件-国际化-下拉搜索
A-B数对问题|UPC-Count Interval|洛谷-P1102A-B数对
对页码的使用总结
Router-view
嵌入式实验二
vivado遇到的问题
小码农的第一篇博客
中国生物反应器行业发展现状及前景规划分析报告报告2022~2028年
该描述怎么写成SQL语句
【反弹shell与提权】
令人愉快的 Nuxt3 教程 (二): 快速轻松地搭建博客
7.18(7)
The result of request.getParameter is on
图的最短路径的核心——松弛技术
中国生物降解塑料行业市场运营态势及发展趋势研究报告2022~2028年
机器码介绍
C语言简单实现三子棋小游戏
controller层到底能不能用@Transactional注解?
中国生活服务O2O行业发展现状与市场规模预测报告2022~2028年
中国水环境治理行业投融资分析及“十四五”规划建议报告2022~2028年









