What will be the output of the query ?
``sql
SELECT MACHINEID, MACHINENAME FROM INVENTORY
WHERE QUANTITY <= 100;
``
What will be the output of the query ?
``sql
SELECT MACHINEID, MACHINENAME FROM INVENTORY
WHERE QUANTITY <= 100;
``
Options
Official answer
Correct option: (D)
The query selects the MACHINEID and MACHINENAME columns only, for rows where QUANTITY is less than or equal to 100 — i.e., the ID and name of machines with quantity less than or equal to 100.
Marking scheme
- 1.1 mark: correct option (D) selected.
Hint
Check exactly which columns follow SELECT and read <= as 'less than or equal to', not 'greater than'.
Quick oral answer
The query projects only MACHINE_ID and MACHINE_NAME for rows where QUANTITY is less than or equal to 100 — matching option (D).
Common mistakes
- 1.Misreading <= as 'greater than' instead of 'less than or equal to'.
- 2.Assuming SELECT with specific column names still displays all columns of the table.
Analysis and explanation
This question checks understanding of the SELECT...WHERE clause with a comparison operator.
Why (D) is correct
- Only MACHINEID and MACHINENAME are listed after SELECT, so only these two columns are displayed, not all columns.
- The condition
QUANTITY <= 100means 'less than or equal to 100', which correctly matches option (D)'s wording.
Why the other options are wrong
- (A) and (C) both wrongly claim 'all columns' are shown, but the SELECT list explicitly restricts output to two columns.
- (A) also wrongly says 'greater than 100', which is the opposite of the actual condition.
- (C) wrongly says 'greater than or equal to 100' and 'all columns', both incorrect.
Interesting facts
SQL comparison operators like <=, >=, <>, and BETWEEN are foundational to filtering data and are used in almost every real-world reporting query.
Choosing only specific columns in SELECT (called 'projection' in relational algebra) reduces the amount of data transferred, which is an important performance consideration in large databases.
Question details
Q14 of 48 questions
- Board
- CBSE
- Class
- Class 12
- Subject
- Computer Science
- Year
- 2026
- Section
- Section A
- Marks
- 1
- Type
- MCQ
- Chapter
- Structured Query Language (SQL)
- Topic
- SQL SELECT with WHERE Clause
- Bloom's level
- apply
- Syllabus topic
- Unit 3: Database Management — SQL DML: SELECT with WHERE Clause and Comparison Operators
- Author
- CBSE
- Reviewed by
- Padhantu Academic Team
Spotted a mistake or something unclear?
Tell us and we will fix it.
Frequently asked questions
What does the <= operator mean in SQL?
<= means 'less than or equal to'. In this query, QUANTITY <= 100 selects all rows where the quantity value is 100 or less, including exactly 100.
Why don't all columns of INVENTORY appear in the output?
Because the SELECT clause explicitly lists only MACHINE_ID and MACHINE_NAME. SQL displays only the columns named in SELECT; to display all columns, SELECT * would be required instead.