Let’s say we have 3 tables: fruit name, color and taste that have data like this:
Fruits:
Apple
Color:
Red
Green
Yellow
Taste:
Sweet
Bitter
I need to come up with a single SQL statement that will combine all 3 tables so that for each fruit there will be as many records as max number of records in any of other tables (in this case 3 records because the Color table has 3 of them) and values will be in order how they appear in source tables like:
Result of a statement I can’t come up with:
Apple Red Sweet
Apple Green Bitter
Apple Yellow NULL
Fruits:
Apple
Color:
Red
Green
Yellow
Taste:
Sweet
Bitter
I need to come up with a single SQL statement that will combine all 3 tables so that for each fruit there will be as many records as max number of records in any of other tables (in this case 3 records because the Color table has 3 of them) and values will be in order how they appear in source tables like:
Result of a statement I can’t come up with:
Apple Red Sweet
Apple Green Bitter
Apple Yellow NULL
Comment