**Problem definition:** a company wants to measure customers satisfaction of their products by asking some questions. company's prducts data stores in "products" table, customers data of each product stores in "customers" table and questions of each product stores in questions table. As simple as below:

> 
> products: [ id, name ]
> 
> 
> customers: [ id, product\_id(fk), name ]
> 
> 
> questions: [ id, product\_id(fk), text ]
> 
> 
> 

the question is, how can we design a table to store answers of each customer by considering that each customer can only answer its product's question. For example, if your answer is something like this:

> 
> customer\_answer:[ id, customer\_id(fk), question\_id(fk), answer ]
> 
> 
> 

then its wrong because if our table's sample data is like the following:

> 
> products: [ 1, "Chair" ], [ 2, "Table" ]
> 
> 
> customers:[ 1, 1, "Anthony Quinn" ], [ 2, 2, "Marilyn Monroe" ]
> 
> 
> question: [ 1, 1, "Any suggestion for this product ?" ], [ 2, 1, "How
>  do you estimate this chair ?" ]
> 
> 
> 

then there **might be** a possible row with below data:

> 
> customer\_answer: [ 1, 2, 1, 'No, thanks' ]
> 
> 
> 

that is wrong, because the customer with id #2 don't have the product\_id #1, so it can be wrong table for this problem.

What can we do in such situations ? 

it doesn't matter but BTW I'm using mysql for solving this problem.