I have a database in Access. The database has 4 tables:
[DEPARTMENT], [TEACHER]
, [LECTURE]
, [SGROUP]
.
I need to display a list of departments whose teachers teach DBMS department students.
The question is: how to do it? I think it should be a query to join multiple times on the same table … but I don’t understand which table to join …
I’m a noob.
Advertisement
Answer
First, you need to add DepNo
value which 3, so the concatenation logically works
INNER JOIN
displays everything you want about;
departments whose teachers teach DBMS department students
x
SELECT DEPARTMENT.DepNo, TEACHER.TechNo, TEACHER.name, DEPARTMENT.name, TEACHER.post
FROM DEPARTMENT
INNER JOIN TEACHER ON DEPARTMENT.DepNo=TEACHER.DepNo
ORDER BY TEACHER.name;
Image chart for What’s the INNER JOIN
:
Reference: