How To Count Rows with the COUNT(*) Function in MS SQL Server?

Submitted by: Administrator
If 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

Read Online MS SQL Server Job Interview Questions And Answers