select * from a,b与select * from a inner join b 的取数方式和执行效率有什么
来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/11 13:59:45
select * from a,b与select * from a inner join b 的取数方式和执行效率有什么不同,
(1)连接
select * from table1,table2
等价于
select * from table1 cross join table2
select * from table1,table2 where table1.row=table2.row
(2)自连接
select * from emploly e1 ,emploly e2
select e1.name,e2.name from employ e1,employ e2
where e1.name=e2.name
(3)内连接(inner join)
select stuname as '姓名',classname as '班级' from student inner join class on student.stuid=class.stuid
inner join '表名' on 条件 --连接多个表
它等价于:
select stuname as '姓名',classname as '班级'
from student,class
where student.stuid=class.stuid
(4)外连接:(outer join)
允许限制一张表中的行,而不限制另外一张表中的行.
注意:外连接不一定非要有外键约束
1: left outer join --不能用left out join
左表中的记录全部会出现在结果集中,匹配不上的显示NULL
2: right outer join
右表中的记录全部会出现在结果集中,匹配不上的显示NULL
3: full outer join|full join --不能用full out join
返回两个表中的匹配和不匹配的所有记录.
select * from table1,table2
等价于
select * from table1 cross join table2
select * from table1,table2 where table1.row=table2.row
(2)自连接
select * from emploly e1 ,emploly e2
select e1.name,e2.name from employ e1,employ e2
where e1.name=e2.name
(3)内连接(inner join)
select stuname as '姓名',classname as '班级' from student inner join class on student.stuid=class.stuid
inner join '表名' on 条件 --连接多个表
它等价于:
select stuname as '姓名',classname as '班级'
from student,class
where student.stuid=class.stuid
(4)外连接:(outer join)
允许限制一张表中的行,而不限制另外一张表中的行.
注意:外连接不一定非要有外键约束
1: left outer join --不能用left out join
左表中的记录全部会出现在结果集中,匹配不上的显示NULL
2: right outer join
右表中的记录全部会出现在结果集中,匹配不上的显示NULL
3: full outer join|full join --不能用full out join
返回两个表中的匹配和不匹配的所有记录.
select * from a,b与select * from a inner join b 的取数方式和执行效率有什么
select ···fromA join B on·····和select····from A inner join B
select * from userinfo a inner join emp b on a.userinfoid li
select * from a union select * from b 能详细说下么
解释数SQL面的 select * from a, b 是什么意思
insert into a select * from b 和select * into a from b 这两个语句是
select * into b from a where 11
insert into a (select * from b)和把记录取出来然后分别insert那个的效率高?
select from 表 和select from [表]有什么不同?
select ** from A where A.id in (select id from B where ****)
SQL语句理解 select * from B where (select count(1) as num from A
$sql_notice = "select * from $t_article art inner join $t_ar