mysql的左连接多个条件查询_mysql——多表——外连接查询——左连接、右连接、复合条件查询...

create table employee ( num int(50),

d_idint(50),

namevarchar(50),

ageint(50),

sexvarchar(50),

homeaddvarchar(50)

);insert into employee values(1,1001,'zhangsan',26,'nan','beijing');insert into employee values(2,1001,'lisi',24,'nv','hunan');insert into employee values(3,1002,'wangwu',25,'nan','jiangsu');insert into employee values(4,1004,'aric',15,'nan','yingguo');select * fromemployee;create table department ( d_id int(50),

d_namevarchar(50),

functionevarchar(50),

addressvarchar(50)

);insert into department values(1001,'keyanbu','yanfachanpin','3lou5hao');insert into department values(1002,'shengchanbu','shengchanchanp','5louyiceng');insert into department values(1003,'xiaoshoubu','cehuaxiaoshou','1louxiaoshoudating');select * fromdepartment;select num,name,employee.d_id,age,sex,d_name,functione from employee,department where employee.d_id =department.d_id;

内连接查询:可以查询两个或者两个以上的表,当两个表中存在表示相同意义的字段时,可以通过该字段来连接这两个表;

当该字段的值相等时,就查询出该记录。=====================&

你可能感兴趣的:(mysql的左连接多个条件查询)