Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 1 : Amit, Chetan / Amit, Chetan

Advertisement

Detailed Solution

सही उत्तर Amit, Chetan / Amit, Chetan है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

employees(name, dept_id, salary) has rows ('Amit', 1, 60000), ('Bina', 1, 40000), ('Chetan', 2, 70000), ('Divya', 2, 50000). What does this query return? / employees(name, dept_id, salary) में पंक्तियाँ ('Amit', 1, 60000), ('Bina', 1, 40000), ('Chetan', 2, 70000), ('Divya', 2, 50000) हैं। यह क्वेरी क्या लौटाती है?

SELECT name FROM employees e WHERE salary > (SELECT AVG(salary) FROM employees WHERE dept_id = e.dept_id) ORDER BY name;

1.
Amit, Chetan / Amit, Chetan
2.
Bina, Divya / Bina, Divya
3.
Amit only / केवल Amit
4.
All four names / चारों नाम

Correct Answer: Amit, Chetan / Amit, Chetan

The correlated subquery computes each employee's own department average: dept 1 average = 50000 (Amit 60000 > 50000 qualifies, Bina 40000 does not); dept 2 average = 60000 (Chetan 70000 > 60000 qualifies, Divya 50000 does not). / सहसंबद्ध उपक्वेरी प्रत्येक कर्मचारी के अपने विभाग का औसत निकालती है: विभाग 1 का औसत = 50000 (Amit 60000 > 50000 योग्य, Bina 40000 अयोग्य); विभाग 2 का औसत = 60000 (Chetan 70000 > 60000 योग्य, Divya 50000 अयोग्य)।

Downloaded from PrepSnap (prepsnap.in)