course 表数据:
teacher 表数据:
INNER JOIN 内连接查询
返回左右两表同时存在的数据
select c.id as course_id, c.course_name, c.teacher_id, t.username as teacher_name from course c inner join teacher t on c.teacher_id = t.id;
course 表数据:
teacher 表数据:
返回左右两表同时存在的数据
select c.id as course_id, c.course_name, c.teacher_id, t.username as teacher_name from course c inner join teacher t on c.teacher_id = t.id;