2012-03-26 12 views
1

"劇場予約システム"と呼ばれるOracleデータベースプロジェクトを行っています。 Customer_ConcessionとMember_Concessionで割引価格を表示しようとしています。 Null可能な外部キーは、TicketテーブルのbookingId、cconcessionId、およびmconcessionIdです。 IDが1つでも存在しない場合でもすべてのチケットを表示したい。 SQLはどのように記述できますか? 私を助けることができますか?おかげさまで Oracle Sqlの開発者はヌルの外部キーを表示する方法

SELECT t.ticketId, pro.name "Production name", PRICE.LEVELID "Price level", 
Price.price "Price", (Price.price - ccons.discountPrice - mcons.discountPrice) 
"Discounted Price", t.seatNo "Seat", t.rowNo "Row", t.block "Block", 
per.performance_date "Performance date", per.start_time "Start time", 
per.end_time "End time", t.availability "Availability" 

FROM Ticket t, Production pro, Performance per, Price, Price_level, 
Booking, Customer, Customer_Concession ccons, Member_concession mcons 

WHERE t.performanceid = per.performanceid AND 
    t.PRODUCTIONID = Price.PRODUCTIONID AND 
    t.levelId = Price.levelId AND 
    Price.PRODUCTIONID = pro.PRODUCTIONID AND 
    Price.levelId = Price_level.levelId AND 
    t.bookingId = Booking.bookingId AND 
    Booking.customerId = Customer.customerId AND 
    ccons.cconcessionId = t.cconcessionId AND 
    mcons.mconcessionId = t.mconcessionId 

ORDER BY t.ticketId 

答えて

2

試してみてください...

WHERE t.performanceid = per.performanceid AND 
     t.PRODUCTIONID = Price.PRODUCTIONID AND 
     t.levelId = Price.levelId AND 
     Price.PRODUCTIONID = pro.PRODUCTIONID AND 
     Price.levelId = Price_level.levelId AND 
     t.bookingId = Booking.bookingId(+) AND 
     Booking.customerId = Customer.customerId(+) AND 
     ccons.cconcessionId(+) = t.cconcessionId AND 
     mcons.mconcessionId(+) = t.mconcessionId 

(古い構文に注意してください)

+0

ありがとうございました!私はそれを解決した! :) – wholee1

関連する問題