黑马程序员c语言教程:空值知识点梳理由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“黑马程序员c语言教程”。
空值知识点梳理含有空值的表达式 都是空null!=null 不能这个语法
---null和空值在一起null的第三点:如果集合中含有空值,不能使用not in 操作符;但可使用in操作符
select *
from emp
where deptno in(10, 20, null)查询部门编号是10 ||||
nul任何部门都不是
if(deptno==10 || deptno==20 || deptno==null)
{
}
select *
from emp
where 1>2
where deptno not in(10, 20, null)
/
---查询部门编号不在10 , 不在20 不在null的员工信息
if(deptno!=10 && deptno!=20 && deptno!=null)
{
}
/空值null的第四点补充:排序的时,如何将null排在最后.按照奖金进行排序查询,员工信息 nulls lastsql语言优化知识点梳理写*号 还是都写出来好
select * from emp;
select empno, ename, comm from emp;解析顺序
select...from tab1, tab2
where con1>1 and con2
where condition1 and condition2
where condition2 and condition1
oracle解析where条件时,从右向左.如果右条件已经是假,左边的就不需要解析了.可以做sql优化先分组在过滤 还是先条件检索在分组
--求10部门的平均工资
//先条件过滤,在求结果
select deptno, avg(deptno)--速度快
from emp
where deptno = 10
group by deptno
select deptno, avg(deptno)
from emp
group by deptno
having deptno = 10子查询
子查询和多表查询
大小写控制函数 大小写控制函数 字符控制函数数字函数ROUND 函数TRUNC 函数MOD 函数......
1 笛卡尔积 部门表 笛卡尔积产生结果: 行数 两个表相乘列数: 行数相加 原因条件等值连接select ****from tab1, tab2where tab1.a = tab2.a1 select count(e.ename)2 from......
--sql structured query language --DML--Data Manipulation Language--数据操作语言 query information (SELECT), add new rows (INSERT), modify existing rows (UPDATE)......
一、选择行1.简单的SELECT 语句SELECT 字段名1 [AS] '字段名1 解释' FROM table; 2.处理NULL NVL函数可把NULL转换成其它类型的符号编程技巧: NVL函数在多条件模糊查询的......
------------------------- --order by的用法--员工信息按照姓名正序排列select * from emp order by ename asc; --员工信息按照倒叙排列select * from emp order by ename......