Number of records from LOANS table where Rate of Interest (RoI) is above 7.0.
Number of records from LOANS table where Rate of Interest (RoI) is above 7.0.
Official answer
SQL Query:
``sql
SELECT COUNT(*) FROM LOANS WHERE RoI > 7.0;
``
This counts only those LOANS records whose Rate of Interest exceeds 7.0%.
Marking scheme
- 1.1 mark for the complete correct query: SELECT COUNT(*) FROM LOANS WHERE RoI > 7.0;
Hint
COUNT(*) with a WHERE clause gives the number of rows satisfying a condition.
Quick oral answer
SELECT COUNT(*) FROM LOANS WHERE RoI > 7.0 counts how many loan records have an interest rate above 7 percent.
Common mistakes
- 1.Writing WHERE RoI > 7 without matching the column's decimal data type/format precisely.
- 2.Using SELECT * instead of SELECT COUNT(*), which lists all matching rows instead of returning a single count.
Analysis and explanation
COUNT(*) is the standard way to count matching rows without needing GROUP BY when only a single overall total is required.
Concept
- WHERE RoI > 7.0 filters rows before COUNT(*) tallies them.
- COUNT(*) counts rows regardless of NULLs in any particular column, unlike COUNT(column_name).
Exam trap
- Using SELECT instead of SELECT COUNT() lists every matching row instead of returning a single numeric count, which does not answer 'number of records'.
Interesting facts
COUNT(*) is generally the fastest counting form in most RDBMS engines because it does not need to check individual column values for NULL.
MySQL evaluates the WHERE clause before any aggregate function is applied, which is why filtering and counting can be combined in a single simple query here.
Question details
Q37 of 48 questions
- Board
- CBSE
- Class
- Class 12
- Subject
- Computer Science
- Year
- 2026
- Section
- Section D
- Marks
- 1
- Type
- Short Answer
- Chapter
- Structured Query Language (SQL)
- Topic
- SQL COUNT() with WHERE Condition
- Bloom's level
- apply
- Syllabus topic
- Unit 2: Database Management — SQL: COUNT(*) aggregate function combined with a WHERE condition on a numeric column
- Author
- CBSE
- Reviewed by
- Padhantu Academic Team
Spotted a mistake or something unclear?
Tell us and we will fix it.
Frequently asked questions
What is the difference between COUNT(*) and COUNT(RoI)?
COUNT(*) counts all rows matching the WHERE condition regardless of NULL values, while COUNT(RoI) would ignore rows where RoI is NULL; for a clean numeric column like RoI, both usually give the same result.
Does the WHERE clause run before or after COUNT(*)?
Before — WHERE filters individual rows first, and only the rows that pass the condition are then counted by COUNT(*).