Subject / 421 questions

Programming MCQs

Page 8 of Programming multiple-choice questions with answers. Tap an option to check yourself.

Page 8 of 22

Advertisement
Question 145 DBMS and SQL

Table Dept(id, name) has rows (10,’HR’), (20,’IT’), (30,’Ops’). Table Emp(id, name, dept_id) has rows (1,’Ali’,10), (2,’Sara’,20), (3,’Omar’,20), (4,’Zara’,NULL). SELECT d.name, COUNT(e.id) FROM Dept d LEFT JOIN Emp e ON e.dept_id = d.id GROUP BY d.name ORDER BY d.name; Which result is produced?

Correct answer C. (HR, 1), (IT, 2), (Ops, 0)

Open question
Advertisement
Advertisement