I am currently trying to run a query that will show all tables that correlate with each other. I did not make the table design. So I am running into some trouble in making: It’s not clear how office_hours table correlates with schedule table? Overall how can I display properly all tables that correlate through a query?
SELECT *
FROM schedule
INNER JOIN semester ON schedule.semester_id = semester.id
INNER JOIN office_hours ON office_hours.id = schedule.???
I think
IDfrom tablescheduleis only anauto_incrementcolumn and the proper way to joinschedulefromoffice_hoursisoffice_hours.schedule_id = schedule.semester_id.UPDATE 1
it is assumed that all
IDor linking columns exists on each table that is whyINNER JOINwas used. Otherwise, useLEFT JOIN.