内连接
select * from employee inner join department on employee.dep_id = department.id
左连接 在内连接的基础上保留左表记录
select * from employee left join department on employee.dep_id = department.id
右连接 在内连接的基础上保留右表记录
select * from employee right join department on employee.dep_id = department.id
全外连接
mysql不支持full join。若要实现该效果,可用下面语句实现:
select * from employee left join department on employee.dep_id = department.id union
select * from employee right join department on employee.dep_id = department.id