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 NULL Values Are Involved in Bitwise Operations? |
☺ | How To Start SQL Server Browser Service? |
☺ | How To Select Some Specific Rows from a Table in MS SQL Server? |
☺ | How To Declare and Use Cursor Variables? |
☺ | PHP MSSQL - How To Display a Past Time in Days, Hours and Minutes? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |
☺ | Sybase Interview Questions. |