Question discussion

What is the output of the following SQL statements?CREATE TABLE t(x INT); INSERT INTO t VALUES (5),(3),(9),(1),(7); SELECT x FROM t ORDER B…

1915Medium DSSSB TGT Computer Science 0 replies 1 views
0

What is the output of the following SQL statements?

CREATE TABLE t(x INT);
INSERT INTO t VALUES (5),(3),(9),(1),(7);
SELECT x FROM t ORDER BY x DESC LIMIT 2 OFFSET 1;
  • A5, 3
  • B9, 7
  • C7, 5
  • D3, 1
Correct answer: C

Explanation

The descending order is 9, 7, 5, 3, 1; OFFSET 1 skips the 9 and LIMIT 2 returns 7 and 5.

Discussion 0

Nobody has replied yet. Start the discussion!