I want to create table in sql, where rows and columns would be some values, and in the (i, j) cell there would be an according value. Something like that:
----------------------------------------
| receipt/ingr | apple | banana | cream
----------------------------------------
| cake | 0 | 1 | 1
| salad | 1 | 1 | 0
----------------------------------------
So that 1 means that recipe contains ingredient. The problem is, that I have large number of ingredients & recipes, so that I can't manually write the names in the select. I have no idea how to create this format.
The tables I have:
Receipts (id, name)
Ingredients (id, name)
Receipt_ingredient (id, receipt_id, ingredient_id)
How can I do it? Thanks in advance