Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Having trouble with creating relationships!

$
0
0
Hi,

The task is:
to set up a database for a charity who mainly raise money by selling tickets to their annual ball and selling products at an auction which takes place at the annual ball....oh and donors can either be companies or private individuals - so I have a table for company donors (info on the company), company contacts (as you might have a number of contacts for each company) and individual donors.

The tables I have set up: (primary keys in red)

Employees (who sell the tickets)
Employee IDEmployee First Name
Employee Last Name
...etc

Company contacts
Company Contact ID
Company Donor IDContact First Name
Contact Last Name
...etc

Company donors
Company Donor IDCompany Name
...etc

Individual donors
Individual donor IDFirst Name
Last Name
...etc

At this point, the relationship between company donors and company contacts would be one-to-many right? Where one company may have many contacts, but each contact can belong to only one company.

The problem I'm having though is how do I make sure Individual Donors and Company Donors have unique IDs? Since I have them listed in 2 seperate tables, they'll start numbering from 1 onwards, so there would be an individual and company donor for every number which isn't what I want - so how do I get around that?

Ticket Type
Ticket Type ID
Price
Description
...etc

Ticket Sales
Ticket Type ID
Employee ID
Donor ID (need to show which individual or company purchased it so both types of donors need a unique ID - as explained above)
Quantity
...etc

In ticket sales, what should I have as my primary key?

Auction products
Product ID
Starting Bid
Description
...etc

Auction Sales
Transaction ID
Donor ID (again I need to show which individual or company purchased it so both types of donors need a unique ID)
Final Bid
...etc

I could really do with some help figuring out the relationships! By the way I'm not sure if I've chosen the right field names as the primary keys so let me kow please if you spoy any that are wrong.

Thank you for all your help in advance!!

Viewing all articles
Browse latest Browse all 13329

Trending Articles