Past ExamsRwanda ICT preparation

Topics / Database

The Staff table has a ManagerID column that refers to another row in the same Staff table. How can a query list each employee with their manager's name?

La table Staff possède une colonne ManagerID qui désigne une autre ligne de la même table Staff. Comment une requête peut-elle lister chaque employé avec le nom de son responsable ?

Answers
AIt is impossible without first creating a separate Managers tableC'est impossible sans créer d'abord une table Managers séparée
BSELECT Name, ManagerID FROM Staff GROUP BY ManagerID, Name ORDER BY ManagerID DESC;SELECT Name, ManagerID FROM Staff GROUP BY ManagerID, Name ORDER BY ManagerID DESC;
CSELECT Name FROM Staff WHERE ManagerID = StaffID;SELECT Name FROM Staff WHERE ManagerID = StaffID;
DJoin Staff to itself: FROM Staff e LEFT JOIN Staff m ON e.ManagerID = m.StaffIDJoindre Staff à elle-même : FROM Staff e LEFT JOIN Staff m ON e.ManagerID = m.StaffID
The answer and explanation are in the full bank.

This question is one of 2,831 in the paid banks. Each comes with the correct answer and the reasoning behind it, not just a mark.

Unlock for 5,000 RWF

MIFOTRA exam practicealigned to Practice set: Database Management·3 marks·Hard

More Database questions