Worked Examples · Example 15
Q.Using the Employee and Dept tables, write an SQL query (an equi-join) to display each employee's name, their department, and the city in which that department is located.
ChseodishaTextbookSubjectiveImportance★★★★★est
100% · 16/16 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →The employee's name and department come from the Employee table, while the department's city comes from the Dept table. To combine them we perform an equi-join on the shared value: Employee.Dept must equal Dept.DeptName.
SELECT Employee.Name, Employee.Dept, Dept.City
FROM Employee, Dept
WHERE Employee.Dept = Dept.DeptName;
This produces one row per employee, each matched to the correct city — for example:
| Name | Dept | City |
|---|---|---|
| Aarti Behera | Sales | Cuttack |
| Rohan Das | Sales | Cuttack |
| Sneha Mohanty | Accounts | Bhubaneswar |
| Manoj Nayak | IT | Bhubaneswar |
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.