-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday-19.sql
More file actions
24 lines (21 loc) · 812 Bytes
/
day-19.sql
File metadata and controls
24 lines (21 loc) · 812 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
-- SQL Advent Calendar - Day 19
-- Title: Gift Wrap Paper Usage
-- Difficulty: easy
--
-- Question:
-- Clara is reviewing holiday orders to uncover hidden patterns — can you return the total amount of wrapping paper used for orders that were both gift-wrapped and successfully delivered?
--
-- Clara is reviewing holiday orders to uncover hidden patterns — can you return the total amount of wrapping paper used for orders that were both gift-wrapped and successfully delivered?
--
-- Table Schema:
-- Table: holiday_orders
-- order_id: INT
-- customer_name: VARCHAR
-- gift_wrap: BOOLEAN
-- paper_used_meters: DECIMAL
-- delivery_status: VARCHAR
-- order_date: DATE
--
-- My Solution:
select sum(paper_used_meters) from holiday_orders
where gift_wrap = TRUE and delivery_status = 'Delivered'