views:

28

answers:

2

I want to know you opinion and what should be the best approach for this case:

I have 2 table called: - clients; - suppliers;

I've create 2 pages for people to leave feedback about a client and for a supplier. With that in mind a created a table feedbacks.

Now the question is which approach should I choose:

1) Create one table called feedbacks with 2 foreign keys (clientid and supplierid). With this approach if they leave a feedback to the client then the FK supplierid would be empty.

2) create 2 tables called clientfeedbacks and suppliersfeedback. With this approach since each table would only have one FK then no FK would be empty.

Thank you.

+2  A: 

Why not just have one table called feedback, and then two separate join tables: client_feedback that maps client_id to feedback_id and then supplier_feedback that amps supplier_id to feedback_id? (has_many through in rails speak)

Ben Taitelbaum
+1: great alternative that is will actually be more descriptive from the data structure than trying to differentiate two data tables or two columns.
Paul Sasik
never thought of that...I like it
Yannick
A: 

By far option #2 is better between the two choices you gave.

Brent Arias