版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
版权
学生表: strdent
INSERT INTO book.student VALUES('1','张三','66','3'); INSERT INTO book.student VALUES(2,'李四','88','3'); insert into book.student values(3,'王五','89','2');
课程表:course
insert into book.course values('1','语文');
左连接:以student 为基础表
select*from studentas s left join courseas c on s.Cid=C.ID;
内连接:除去有null 值的数据
select*from studentas s inner join courseas c on s.Cid= C.ID;
右连接: 以课程表为基础
select*from studentas s right join courseas c on s.Cid=C.ID;