为验证不同连接表达式的区别,先建立下面的表:
teachers
students
(1) (inner) join: 对表A和表B取笛卡尔积(内连接,inner可以省略)
select students.*,teacher_name,course_id from students join teachers;
结果如下:
(2)natural (inner) join: 自然连接只考虑在两个关系表中都出现的属性取值上相同的元组对
select students.*,teacher_name,course_id from students natural join teachers;
结果如下:
事实上
select students.