How To Count Rows with the COUNT(*) Function in MS SQL Server?
Submitted by: AdministratorIf you want to count the number of rows, you can use the COUNT(*) function in the SELECT clause. The following tutorial exercise shows you some good examples:
SELECT COUNT(*) FROM ggl_links
GO
7
SELECT COUNT(*) FROM ggl_links
WHERE url LIKE '%glo%'
GO
3
So there are 7 rows in total in table "ggl_links", and 3 rows that have 'glo' as part of their url names.
Submitted by: Administrator
SELECT COUNT(*) FROM ggl_links
GO
7
SELECT COUNT(*) FROM ggl_links
WHERE url LIKE '%glo%'
GO
3
So there are 7 rows in total in table "ggl_links", and 3 rows that have 'glo' as part of their url names.
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | What Happens If You Insert a Duplicate Key for the Primary Key Column in MS SQL Server? |
☺ | What Are the Character String Functions Supported by SQL Server 2005? |
☺ | How To Execute the Cursor Queries with "OPEN" Statements? |
☺ | How To Defragment Indexes with ALTER INDEX ... REORGANIZE? |
☺ | How To Configure ODBC DSN with Different Port Numbers? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Sybase Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |