Monday, August 29, 2011

SQL COUNT


The SQL COUNT aggregate function is used to count the number of rows in a database table.


The SQL COUNT syntax is simple and looks like this: 


SELECT COUNT(Column1)
FROM Table1

If we want to count the number of Company in our Company table, we will use the following SQL COUNT statement:


SELECT COUNT(LastName) AS NoofCompany
FROM Company

The result of this SQL COUNT query will be: 

NoofCompany
4


MORE BASIC SQL COMMANDS



No comments:

Post a Comment