36. Size × Color Product Matrix
MediumJoinsCROSS JOINCartesian product
A CROSS JOIN produces the Cartesian product — every row of one table paired with every row of the other. It's the tool for generating all combinations, like every size/color variant a garment could come in.
Task: produce the full matrix of every size paired with every color. With 3 sizes and 2 colors you get 3 × 2 = 6 rows.
Output columns, in this exact order: size, color. Order by size ascending, then color ascending.
Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…
This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases — 5test cases in all. A sloppy query that only fits the example won't pass.
SQL· SQLite · runs in your browser
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.