解析關(guān)于SQL語句Count的一點細(xì)節(jié)建站知識
導(dǎo)讀:1建站知識本篇文章是對關(guān)于SQL語句Count的一點細(xì)節(jié)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下seo網(wǎng)站關(guān)鍵詞優(yōu)化網(wǎng)站建設(shè)公司。
count語句支持*、列名、常量、變量,并且可以用distinct關(guān)鍵字修飾, 并且count(列名)不會累計null的記錄。下面隨便用一些例子示范一下count的規(guī)則:比如對如下表做統(tǒng)計,所有列這里都用sql_variant類型來表示。
復(fù)制代碼 代碼如下:
if (object_id ('t_test' )> 0 ) drop table t_test go create table t_test (a sql_variant , b sql_variant , c sql_variant )insert into t_test select 1 , 1 , 'a' insert 個業(yè)網(wǎng)站建設(shè)公司into t_test select 1 , getdate (), null insert into t_test select 'a' , null , 1 insert into t_test select 3 , null , null insert into t_test select null , null , null go select * from t_test 網(wǎng)站seo優(yōu)化課程go select count (* ) --總數(shù) , count (null網(wǎng)站優(yōu)化seo培訓(xùn)if (1 , 1 )) --永遠(yuǎn)返回0 , count (a ) --a數(shù)量 , count (b) --b數(shù)量 , count (distinct a ) --a不重復(fù)數(shù)量 , count (isnull (b, c )) --b或者c不為null數(shù)量 , count (Coalesce (a , b, c )) --a或者b或者c不為null數(shù)量 , count (nullif (a , b)) --a不等于b的數(shù)量 , count (nullif (isnumeric (cast (a as varchar (38 ))), 0 ))--a是數(shù)字的數(shù)量 from t_test
相關(guān)seo網(wǎng)站關(guān)鍵詞優(yōu)化網(wǎng)站建設(shè)公司。關(guān)鍵詞標(biāo)簽: 細(xì)節(jié) SQL 語句
聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-05-23 ,文章解析關(guān)于SQL語句Count的一點細(xì)節(jié)建站知識主要講述語句,細(xì)節(jié),SQL網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請保留鏈接: http://www.bifwcx.comhttp://www.xahuichuang.com
為你推薦與解析關(guān)于SQL語句Count的一點細(xì)節(jié)建站知識相關(guān)的文章
-
通王TWCMS 2.0.3網(wǎng)站模板程序下載
(126)人喜歡 2024-01-15 -
Windows官方原版在哪里下載
(175)人喜歡 2024-01-15 -
WordPress網(wǎng)站模板發(fā)帖標(biāo)題顏色設(shè)置
(131)人喜歡 2024-01-07 -
修改discuz論壇帖子標(biāo)題80字符的長度限制
(249)人喜歡 2024-01-07 -
wordpress程序調(diào)用不帶超鏈接的Tag標(biāo)簽
(234)人喜歡 2024-01-05 -
網(wǎng)站在不同時期需調(diào)整內(nèi)容更新的方向
(112)人喜歡 2023-08-12