field relationship understanding needed

antonyx

Arsenal Supporter
Local time
Today, 20:46
Joined
Jan 7, 2005
Messages
556
ok, let me please ask this question regarding a payment relationship in my database

it will be paid in four ways, cash, creditcard, cheque, paypal

each of these payment types will have their own features..

eg creditcard (name on card, card number)

cheque (cheque date, date cleared)

paypal (username...YOU GET THE PICTURE

so is this below way a good way to store these details, or can i do it with 4 less tables..

http://bb.1asphost.com/antonyx6/untitled2.jpg

if this way is correct, i dont see how each id will be entered..
eg
if i enter some cheque details.. will that lead the chequeid to be linked to the paymentid, and the paymentid to the bookingid, and the bookingid to the booking details etc
 
I think I would use one table. It appears you need a date field, a string fields, and maybe a number field (to record amount?) plus the payment type and foreign key to point back to the invoice.
 
how could i do that.. there are going to be a lot of other things to do with the bookings also mite i add..

you are rite, there are a few common fields that relate to any payment method such as job price.. total price.. etc

but what about the individual features of each payment..

i cant see how i can do this.. would i put all the fields for all the payment types in one table??
 
Are you saying there might be more fields added? It is hard to advice on your database design when we know so little about it.
 
ok in about an hour or so ill put it some more fields and show you guys, thanks for this, much appreciated.
 
Here is the deal. By using one table, it makes quering the data much easier. Sure you may have one field that has multi-uses (maybe Account number for one type, and username for another as an example), but one query will return all the information. With multi-tables you really need multi-queries to return the data. This complicates everything. Now that maybe what you want, we don't know. But I thought it worth a mention.
 

Users who are viewing this thread

Back
Top Bottom