-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignments_section5.sql
More file actions
61 lines (22 loc) · 974 Bytes
/
assignments_section5.sql
File metadata and controls
61 lines (22 loc) · 974 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-- Connect to database
-- ASSIGNMENT 1: Numeric functions
-- Calculate the total spend for each customer
-- Put the spend into bins of $0-$10, $10-20, etc.
-- Number of customers in each spend bin
-- ASSIGNMENT 2: Datetime functions
-- Extract just the orders from Q2 2024
-- Add a column called ship_date that adds 2 days to each order date
-- ASSIGNMENT 3: String functions
-- View the current factory names and product IDs
-- Remove apostrophes and replace spaces with hyphens
-- Create new ID column called factory_product_id
-- ASSIGNMENT 4: Pattern matching
-- View the product names
-- Only extract text after the hyphen for Wonka Bars
-- Alternative using substrings
-- ASSIGNMENT 5: Null functions
-- View the columns of interest
-- Replace NULL values with Other
-- Find the most common division for each factory
-- Replace NULL values with top division for each factory
-- Replace division with Other value and top division