SELECT, WHERE & ORDER BY · Question 5 · Easy

SELECT, WHERE & ORDER BY question 5

Table Students:
roll | name | city | marks
1 | Aarav | Pune | 78
2 | Diya | Mumbai | 91
3 | Kabir | Pune | 64
4 | Meena | Chennai | 91
5 | Rohan | Mumbai | NULL
6 | Sneha | Pune | 85

Which names does this query return?

SELECT name
FROM Students
WHERE city IN ('Mumbai', 'Chennai')
ORDER BY name;
  1. Diya; Rohan
  2. Diya; Meena
  3. Aarav; Kabir; Sneha
  4. Diya; Meena; Rohan
Answer and explanation

Answer: D. Diya; Meena; Rohan

Explanation: IN is true when city equals any value in the list. Diya and Rohan are from Mumbai and Meena is from Chennai; Rohan's NULL marks do not matter because marks is not tested.

Previous: Table Payments: txn_id | payer | app | amount | status 1 | Farhan | GPay | 250… · Next: Table Products: pid | name | category | price | stock 1 | Kurta | Clothing |…

Practise select, where & order by

Try a fresh set of select, where & order by questions with an explanation after every answer, free and without signing up: SELECT, WHERE & ORDER BY practice. Or sit a full placement mock test.

More select, where & order by questions

More sql practice

SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE · UNION, INTERSECT & EXCEPT · Tables, Keys & Constraints

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge