EER help for payment

1.1k Views Asked by At

Guys I am developing my project in Mysql Workbench and have a confusion about my project.

I have few questions:

How do we manage different types of payments? I mean my DB has a payment table and my system has 3 modes for payment.

1]Credit Card(Will store the respective information)

2]DebitCard(Will store the respective information)

3]Cash on Delivery(the payment is done in cash and will be updated later)

I have uploaded a image here to tell you what I was thinking

Bill table-Consists of bill generation and stuff. Payment table-As to when the payment is done (I have added a type id and fks from all table so that I can use a if/else clause on the select method.) is this good practive? Home table- is the cash on delivery thong

Is there any better method to do this? Please help.

enter image description here

I have further modified the image and have chucked out the type condition and instead I am using the if(payment_type) clause to access the respective DB, I believe this should get the job done. Is there any fault in this? Please help

enter image description here

1

There are 1 best solutions below

2
David Sonnenfeld On BEST ANSWER

Indeed. There is. I would go with inheritance.

Here a simple diagram:

enter image description here

You need to include your attributes and notations (oneTOone, manyTOone,...). Do some research for inheritance.

Look here: http://de.scribd.com/doc/7122945/ER-Diagram And there are more if you google or stackoverflowle.

Regards ;-)