-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday-09.sql
More file actions
28 lines (25 loc) · 1009 Bytes
/
day-09.sql
File metadata and controls
28 lines (25 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- SQL Advent Calendar - Day 9
-- Title: Tinsel and Light Combinations
-- Difficulty: hard
--
-- Question:
-- The elves are testing new tinsel–light combinations to find the next big holiday trend. Write a query to generate every possible pairing of tinsel colors and light colors, include in your output a column that combines the two values separated with a dash ("-").
--
-- The elves are testing new tinsel–light combinations to find the next big holiday trend. Write a query to generate every possible pairing of tinsel colors and light colors, include in your output a column that combines the two values separated with a dash ("-").
--
-- Table Schema:
-- Table: tinsel_colors
-- tinsel_id: INT
-- color_name: VARCHAR
--
-- Table: light_colors
-- light_id: INT
-- color_name: VARCHAR
--
-- My Solution:
SELECT
t.color_name AS tinsel_color,
l.color_name AS light_color,
CONCAT(t.color_name, '-', l.color_name) AS combination
FROM tinsel_colors t
CROSS JOIN light_colors l;