-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday-17.sql
More file actions
23 lines (20 loc) · 864 Bytes
/
day-17.sql
File metadata and controls
23 lines (20 loc) · 864 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 17
-- Title: Evening Task Categories
-- Difficulty: medium
--
-- Question:
-- During a quiet evening of reflection, Cindy Lou wants to categorize her tasks based on how peaceful they are. Can you write a query that adds a new column classifying each task as 'Calm' if its noise_level is below 50, and 'Chaotic' otherwise?
--
-- During a quiet evening of reflection, Cindy Lou wants to categorize her tasks based on how peaceful they are. Can you write a query that adds a new column classifying each task as 'Calm' if its noise_level is below 50, and 'Chaotic' otherwise?
--
-- Table Schema:
-- Table: evening_tasks
-- task_id: INTEGER
-- task_name: VARCHAR
-- noise_level: INTEGER
--
-- My Solution:
SELECT task_id, task_name, noise_level,
case when noise_level<50 then 'calm'
else 'Chaotic' end as mood
from evening_tasks