-1

ここに私のテーブル設計があります

PERSON
DriverID (primary)
DriverName
Address

CAR
RegNO (primary) 
Model 
Year

ACCIDENT
ReportNumber (primary)
AccidentDate
Location

OWNS
DriverID (primary key)  foreign key with PERSON(DriverID)
RegNo (primary Key) foreign key with CAR(RegNo)

PARTICIPATION
DriverID (primary key) foreign key with PERSON (DriverID)
RegNo (primary Key) foreign key with CAR(RegNo)
ReportNumber (primary key) foregin with ACCIDENT(primary)
Damage Amount

ここで、これらすべてのテーブルを結合したいので、次の列を出力する必要があります DriverID DriverName Address RegNo Model Year ReportNumber AccidentDate Location DamageAMount

4

1 に答える 1

1

これを試して ::

Select
* 
from 
participation pt

inner join PERSON p on (p.DriverID = pt.DriverID )
inner join car c on (pt.RegNo =c.RegNo)
inner join accidents a on (pt.ReportNumber =a.ReportNumber)

削除クエリは

delete
from 
participation pt

inner join PERSON p on (p.DriverID = pt.DriverID )
inner join car c on (pt.RegNo =c.RegNo)
inner join accidents a on (pt.ReportNumber =a.ReportNumber)
where p.DriverID = 111
于 2012-12-10T05:55:41.317 に答える