If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Help With Entity Relation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Nov 2012
Posts: 1
Help With Entity Relation

Hi everyone. First of all, yes this is a homework question. I've tried working it out myself but alas here I am.

Anyway. here goes.

I have these 3 entities. Passenger, Company, Payment

----------
Passenger
----------
CustomerNum(PK)
DOB(PK)
First_Name
Last_Name
Gender
Street
Zip

---------
Company
---------
CompanyNum(PK)
Name
Street
Zip

---------
Payment
---------
TransactionNum(PK)
Date(PK)
Amount
Method

Basically a passenger makes a payment. Also a company makes a payment.
But a payment can only be made by either a passenger or a company not both. How can i form that sort of relation? Is it possible?
Reply With Quote
  #2 (permalink)  
Old
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 20,000
do a search for supertype/subtype

you need a supertype table (clients?) to which both passengers and companies belong as subtypes

then relate payments to clients
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On