Multiple choice

How can we count the number of records in the sample table?

  1. Select column(*) from sample

  2. Select count() from sample

  3. Select column() from sample

  4. Select count(*) from sample

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Count is an aggregate or group function. It is used to count the number of records in a table or number of not null values in a column. It can be used in the following ways:1. Select count(*) from tablename, the above statement will display the number of records in a table.2. Select count(address) from tablename, the above statement will display the number of values in the address column. It will not count the rows where the column address has a NULL value.Some other aggregate functions are1. Sum, 2. Min, 3. Max, 4. Avg etc.