CBSE Class 12 Informatics Practices Question 36 of 79

Database Query using SQL — Question 7

Back to all questions
7
Question

Question 7

What SQL statement do we use to find the total number of records present in the table Product?

  1. SELECT * FROM PRODUCT;
  2. SELECT COUNT(*) FROM PRODUCT;
  3. SELECT FIND(*) FROM PRODUCT;
  4. SELECT SUM() FROM PRODUCT;
Answer

SELECT COUNT(*) FROM PRODUCT;

Reason — The SQL statement SELECT COUNT(*) FROM PRODUCT; is used to retrieve the total number of records or rows present in the "PRODUCT" table. The COUNT(*) function counts all rows along with the NULL values in a specified table, and the SELECT keyword is used to fetch data from the database.