KingSunSha您好:代码如下:select distinct vehicle.VID, vehicle.VTYPEID, vehicle.FRAMENO, vehicle.ENGINENO,vehicle.GEARBOXNO,vehicle.ADORNCOLOR,voiturecolor.vcname,vehicletype.VTNAME from vehicle,repair,enterprise,police,vehicletype,voiturecolor where vehicle.bodycolor=voiturecolor.vcno and vehicle.vstyle=vehicletype.vstyle and repair.license=enterprise.license and vehicle.vno=repair.vno and police.polino=enterprise.master and vehicle.vid like '-1%'请帮忙!谢谢!
select distinct a.VID, a.VTYPEID, a.FRAMENO, a.ENGINENO,a.GEARBOXNO,a.ADORNCOLOR, f.vcname,e.VTNAME from vehicle a, repair b, enterprise c, police d, vehicletype e, voiturecolor f where a.bodycolor=f.vcno and a.vstyle=e.vstyle and a.vno=b.vno and b.license=c.license and c.master =d.polino and a.vid like '-1%' 整理了你的语句,发现,没有从b,c,d中选择任何东西,为什么要连接它 起码。可以写成 select distinct a.VID, a.VTYPEID, a.FRAMENO, a.ENGINENO,a.GEARBOXNO,a.ADORNCOLOR, f.vcname,e.VTNAME from vehicle a, vehicletype e, voiturecolor f where a.bodycolor=f.vcno and a.vstyle=e.vstyle and a.vid like '-1%'
select distinct a.VID, a.VTYPEID, a.FRAMENO, a.ENGINENO, a.GEARBOXNO, a.ADORNCOLOR, f.vcname, e.VTNAME from vehicle a,repair b , enterprise c,police d, vehicletype e,voiturecolor f where a.bodycolor=f.vcno and a.vstyle=e.vstyle and b.license=c.license and a.vno=b.vno and d.polino=c.master and a.vid like '-1%'表间关系如下: a-b,b-c,c-d,a-e,a-f你确定你的连接那些字段是pk吗?如果不是的话,出现笛卡集的机会很大。
这个表空间是你在处理事务的时候用作排序的,你可以做一个试验,
在你进行处理的时候有意识的查看你的用户对应的temporary tablespace的容量,你会发现,他几乎是直线上升的。但你的事务处理完毕的时候,他的容量又会恢复的原来大小。所以如果你的临时空间一直资源占用的的话,多数是你的事务处理还没有完成,如果你确信已经完成了的话,但他还是无法释放,结束你的事务,若还是不可以,重起你的系统。
where vehicle.bodycolor=voiturecolor.vcno and vehicle.vstyle=vehicletype.vstyle and repair.license=enterprise.license
and vehicle.vno=repair.vno
and police.polino=enterprise.master and vehicle.vid like '-1%'请帮忙!谢谢!
又是distinct,又是like,还这么多表,这么多连接,你在做什么呢?
repair-->license,vehicle-->vid,police-->polino,表名-->字段建的索引!
而distinct是必须的,还有别的办法么?
f.vcname,e.VTNAME
from vehicle a,
repair b,
enterprise c,
police d,
vehicletype e,
voiturecolor f
where a.bodycolor=f.vcno
and a.vstyle=e.vstyle
and a.vno=b.vno
and b.license=c.license
and c.master =d.polino
and a.vid like '-1%'
整理了你的语句,发现,没有从b,c,d中选择任何东西,为什么要连接它
起码。可以写成
select distinct a.VID, a.VTYPEID, a.FRAMENO, a.ENGINENO,a.GEARBOXNO,a.ADORNCOLOR,
f.vcname,e.VTNAME
from vehicle a,
vehicletype e,
voiturecolor f
where a.bodycolor=f.vcno
and a.vstyle=e.vstyle
and a.vid like '-1%'
a.VTYPEID,
a.FRAMENO,
a.ENGINENO,
a.GEARBOXNO,
a.ADORNCOLOR,
f.vcname,
e.VTNAME
from vehicle a,repair b ,
enterprise c,police d,
vehicletype e,voiturecolor f
where a.bodycolor=f.vcno
and a.vstyle=e.vstyle and
b.license=c.license
and a.vno=b.vno
and d.polino=c.master
and a.vid like '-1%'表间关系如下:
a-b,b-c,c-d,a-e,a-f你确定你的连接那些字段是pk吗?如果不是的话,出现笛卡集的机会很大。
他们之间有何区别呀?谢谢!
请问如何创建一个事务级或对话级的临时表?
他们之间的区别是什么?