ORACLE count 統計函式的使用

2022-08-04 21:51:17 字數 742 閱讀 8518

sql中用於統計的函式時:count()。

針對count函式的使用做乙個記錄,很簡單。

首先我資料庫中建個表test,資料如下:

表中id和name都是不重複的資料,home、tel、path中存在重複資料,其中path中存在空資料。

現查詢語句如下:

select

count(*) , count(1) ,count( distinct home) , count( distinct tel) , count(path) , count( distinct path) from test;

count(*) :統計表中所有的記錄數量,包括null資料。

count(1) :統計表中所有資料數量,和上面的一樣,不過效率要比count(*)快。

count( distinct home) :統計表中去重之後的home資料

count( distinct tel) :統計表中去重之後的tel資料,此表中tel值只有兩個不同的資料。

count(path) :統計表中所有的path值,但是會自動去除null資料,此表中有三條null資料。

count( distinct path)統計表中去重之後的資料總數(肯定不會包括null資料)。

查詢結果如下:

Oracle Count 函式的實驗

以下一點小經驗,希望對你們有所幫助。在做專案的時候,有修改到的procedure中寫了類似這樣一句 select count b.planrmk into varplantmkcount from smtbcrud b where if varplantmkcount 0 select b.plan...

GNU C函式統計

我是根據gnu c文件的附錄b來統計的 file usr share doc glibc doc html libc 36.html 統計結果如下 1 iso amend1 1 sun 1 sunos 1 unknown 1 vtimes.h 1 xopen 1 xpg4 2 bsd svid 2 ...

統計函式sum ,mean ,std

import numpy as np arr np.random.randn 4,4 print arr print 求和 arr.sum print 算數平均數 arr.mean print 標準差 arr.std 上面這些函式也可以傳入axis引數,用於計算指定軸的方向。import numpy...