티스토리 뷰
In Microsoft SQL Server, the `COUNT(*)` and `COUNT(column)` functions are both used to count the number of rows in a table or a result set. However, they have a subtle difference:
1. **COUNT(*)**: This function counts the total number of rows in a table, including rows with NULL values in any column.
Example:
```
SELECT COUNT(*) FROM TableName;
```
2. **COUNT(column)**: This function counts the number of non-NULL values in the specified column.
Example:
```
SELECT COUNT(column) FROM TableName;
```
So, if you want to count all rows regardless of the values in a particular column, use `COUNT(*)`. If you want to count only the non-NULL values in a specific column, use `COUNT(column)`.
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- hyper-v
- 아이폰
- In App Purchase
- 앱 스토어
- App Store
- 문자 자르기
- mssql
- nl2br
- html tag
- trim
- 명령어
- System.Diagnostics
- 특정 문자를 기준으로 자르기
- system.io
- 진수 변환
- Task
- 상품 등록
- 제품 등록
- FileUpload
- MainActor
- await
- async
- .submit()
- 공백제거
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함