I want to insert values into a Table_C by cross joining two tables Table_A and Table_B.
Table_A contains two attributes ID and item.
Table_B contains two attributes ID and color.
Table_C contains four attributes ID,item,color,quantity.
All IDs have AUTO INCREMENT.
suppose each item can have all color and I need to create a relation about it.
How should I write a query for this? How could I reference a relation cross joining item and color.
What my solution is create an intermediate third table joining these two tables and then use that table to insert values into Table_C. But I am pretty sure that there is a better optimized solution for this.
Thanks in advance.