OA. free
Free
Micron Computer Science Databases Medium

Consider the following Employee relation: EmpID Name Salary Department :---: :---: :---:...

Micron technical mcq question, verified with a worked answer. Free to practise - no sign-up.

Consider the following Employee relation:

EmpID Name Salary Department
1 Rajesh 25000 IT
2 Suresh 30000 HR
3 Ramesh 40000 Finance
4 Priya 18000 Marketing
5 Anjali 12000 Operations

What is the output returned by executing the following SQL query?

SELECT Name FROM Employee WHERE salary IN (25000, 40000, 8000);
Choose one option.
Show answer & explanation
Answer: B. Rajesh, Ramesh

The IN predicate filters rows where the salary column matches any value in the list (25000, 40000, 8000). Scanning the Employee table: Rajesh has salary 25000 (matches), Ramesh has salary 40000 (matches), and no employee has salary 8000. Therefore, only Rajesh and Ramesh are returned.

Step-by-step Derivation:
Step-by-step evaluation:

  1. Query: SELECT Name FROM Employee WHERE salary IN (25000, 40000, 8000)
  2. Check each row:
    • EmpID 1: Rajesh, Salary 25000 → 25000 IN (25000, 40000, 8000)? YES ✓
    • EmpID 2: Suresh, Salary 30000 → 30000 IN (25000, 40000, 8000)? NO
    • EmpID 3: Ramesh, Salary 40000 → 40000 IN (25000, 40000, 8000)? YES ✓
    • EmpID 4: Priya, Salary 18000 → 18000 IN (25000, 40000, 8000)? NO
    • EmpID 5: Anjali, Salary 12000 → 12000 IN (25000, 40000, 8000)? NO
  3. Result set: {Rajesh, Ramesh}