-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday-10.sql
More file actions
23 lines (20 loc) · 715 Bytes
/
day-10.sql
File metadata and controls
23 lines (20 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- SQL Advent Calendar - Day 10
-- Title: Cookie Factory Oven Efficiency
-- Difficulty: easy
--
-- Question:
-- In the holiday cookie factory, workers are measuring how efficient each oven is. Can you find the average baking time per oven rounded to one decimal place?
--
-- In the holiday cookie factory, workers are measuring how efficient each oven is. Can you find the average baking time per oven rounded to one decimal place?
--
-- Table Schema:
-- Table: cookie_batches
-- batch_id: INT
-- oven_id: INT
-- baking_time_minutes: DECIMAL
--
-- My Solution:
select oven_id, round(avg(baking_time_minutes), 1) as average_baking_time
from cookie_batches
group by oven_id
order by average_baking_time DESC