sqlä¸æ¥è¯¢è®°å½æ°ç¨countå½æ°ã
1ãå建æµè¯è¡¨ï¼æå
¥æ°æ®ï¼
1
2
3
4
5
6
7
create table test
(id int)
insert into test values (1)
insert into test values (2)
insert into test values (3)
insert into test values (null)
2ãæ¥è¯¢è®°å½æ°ä¸ºä¸¤ç§ï¼ä¸ç§æ¯count(*)ï¼ä¸ç§æ¯count(å段å¼)ï¼
æµè¯ä¸ï¼
1
select count(*) from test
ç»æï¼
æµè¯äºï¼
1
select count(id) from test
ç»æï¼
说æï¼å¦æcount(å段å)çå段ä¸å«æ空å¼ï¼åå¨countä¸ä¸è®¡æ°ï¼ècount(*)åæ¯æ¥è¯¢å
¨é¨çè¡æ°
温馨提示:内容为网友见解,仅供参考