1. teacher table:
a. id
b. name
2. subject table:
a. id
b. major
3. handler table: who teacher handle the major
a. id
b. tid // teacher id
c. sid // subject id
The problem is how to get a display of the third table with naming by using just one select statement. The answer is below:
SELECT t.name, s.major FROM teacher t, subject s, handler
WHERE handler.tid = t.id AND handler.sid = s.id
No comments:
Post a Comment