Mysql – Data design issue. Need help with normalization

database-designMySQLnormalization

I am developing one web based payment system. I am facing problem in database design.

Following are tables and their fields:

Customer: cust_id    , name   
Supplier: supplier_id, name   
Employee: employee_id, name   
Expanse:  expanse_id , name

group: group_id, group_name   
(groups are: {1,Customer},{2,Supplier},{3,Employee},{4,Expanse})

and there will be one more table:

payment: payment_id, group_id, name(ids), amount

In above table, name field will contain id of respective group. Like if group id is 1 and name is 15 that is customer whose id is 15 (customer_id=15)

I want to know that above tables satisfy 3NF? if not then what is the correct way.

Also i want to know that if i want list of all the payment, which will have fields like: payment_id, group_name, name_of_person/expanse. What will be the query to get this list.

Best Answer

One of these is not like the others - expanse

Entities:
groupID, ID, name

composite PK on groupID, ID

Related Question