Question discussion

What does the following query return?CREATE TABLE e(name TEXT, sal INT); INSERT INTO e VALUES ('A',30),('B',50),('C',70),('D',90); SELECT n…

1163Medium DSSSB TGT Computer Science 0 replies 1 views
0

What does the following query return?

CREATE TABLE e(name TEXT, sal INT);
INSERT INTO e VALUES ('A',30),('B',50),('C',70),('D',90);
SELECT name FROM e
WHERE sal > (SELECT AVG(sal) FROM e) ORDER BY name;
  • AB, C, D
  • BC, D
  • CD
  • DA, B
Correct answer: B

Explanation

The average salary is 60, so only C (70) and D (90) earn more.

Discussion 0

Nobody has replied yet. Start the discussion!