sqlite的count函數可以加條件嗎
1 回答

大話西游666
TA貢獻1817條經驗 獲得超14個贊
把select查詢語句中的列選擇部分換成count(*)或者count(列名)。那么查詢語句就會返回select查詢結果的數據有多少條。也就是帶有count的查詢,其返回結果就是一行一列的一個數字。
例如:
select * from student where name like '張%'; //查詢所有姓張的學生信息
select count(*) from student where name like '張%' //查詢姓張的學生的人數
而count(列名)在統計結果的時候,會忽略列值為空(這里的空不是只空字符串或者0,而是表示null)的計數。
select count(en_score) from student where name like '張%' //查詢姓張的學生中有英語成績的學生人數!
- 1 回答
- 0 關注
- 1464 瀏覽
添加回答
舉報
0/150
提交
取消