CS FundamentalsModerateProduct placement · SQL round

Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4, 'Dev', 'Tech', NULL, 3), (5, 'Esha', NULL, 35, 3), (6, 'Farid', 'Tech', 70, 2). What does this query return?

Table Staff(id, name, dept, pay, boss) rows: (1, 'Anu', 'Ops', 40, NULL), (2, 'Bala', 'Ops', 55, 1), (3, 'Chitra', 'Tech', 70, 1), (4, 'Dev', 'Tech', NULL, 3), (5, 'Esha', NULL, 35, 3), (6, 'Farid', 'Tech', 70, 2). What does this query return?
SELECT COUNT(*) FROM Staff WHERE name LIKE '_a%';
  1. A. 2
  2. B. 3
  3. C. 1
  4. D. 4

Correct answer: A. 2

'_' matches exactly one character, then 'a', then anything: Bala and Farid have 'a' as the second letter.

More DBMS and SQL questions

Exams that ask this topic