Informatics Practices

Which SQL statement do we use to find out the total number of records present in the table ORDERS ?

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

SQL Queries

2 Likes

Answer

SELECT COUNT(*) FROM ORDERS ;

Reason — The COUNT() function in SQL counts the number of rows or records in a table. When used with the asterisk (*), it counts all rows in the table, including duplicates and nulls. Therefore, SELECT COUNT(*) FROM ORDERS will return the total number of records in the ORDERS table.

Answered By

2 Likes


Related Questions