zoukankan      html  css  js  c++  java
  • Count(*) 与 count(field) 一样吗?

    有这么个表:

    执行 

    select count(*) from hy_test

    select count(deptno) from hy_test

    都得到 5

    但执行

    select count(name) from hy_test

    却得到 

    原来count(字段)是取 字段中不为空的记录数,所以name=null的三条被忽略了。

    附:建表语句

    CREATE TABLE hy_test
    (
        deptno NUMBER(8,0) not null primary key,
        name NVARCHAR2(60)
    )

    插值语句:

    insert into hy_test(deptno,name) values('1','Hr');
    insert into hy_test(deptno,name) values('2','Dev');
    insert into hy_test(deptno) values('3');
    insert into hy_test(deptno) values('4');
    insert into hy_test(deptno) values('5');

    --END-- 2019-12-31 16:27

  • 相关阅读:
    Twisted
    day10-redis操作
    day9mysql操作
    day9-paramiko
    day10-rabbitmq
    day9-协程
    day8-异常
    Linux 软连接
    nginx 配置篇
    ansilbe基础学习(一)
  • 原文地址:https://www.cnblogs.com/heyang78/p/12124679.html
Copyright © 2011-2022 走看看