sql优化的原则和空值问题

优化

1.尽量使用列名的方式取代*

2where解析顺序:右--》左

null值

2.sql中的null

1、包含null的表达式都为null

2、null永远!=null

  • SQL> select *
  •            2  from emp
  •            3  where comm=null;   (应改为comm is null)
  • 3、滤空函数 nvl(a,b)

3、如果集合中含有null,不能使用not in;但可以使用in

3。日期和字符只能在单引号中出现,双引号是列明

猜你喜欢

转载自blog.csdn.net/weixin_41402352/article/details/82948122