-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsustainability_analysis.sql
More file actions
81 lines (69 loc) · 2.22 KB
/
sustainability_analysis.sql
File metadata and controls
81 lines (69 loc) · 2.22 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
Project: Intel Sustainability Impact Analysis
Author: Brandon Tuchtenhagen
Date: 10/14/2025
Description: SQL queries used to evaluate the Cost-Effectiveness Index of
repurposing devices vs. recycling them.
*/
-- TASK 1: ORGANIZING AND UNDERSTANDING THE DATA
-- Objective: Inspect the dataset to understand device distribution by type and age.
-- 1. Count total devices by category (Laptop, Desktop, Tablet)
SELECT
device_type,
COUNT(*) AS total_count
FROM
repurposed_devices_2024
GROUP BY
device_type
ORDER BY
total_count DESC;
-- 2. Identify average age of devices to assess refurbishment viability
SELECT
device_type,
AVG(device_age_years) AS avg_age
FROM
repurposed_devices_2024
GROUP BY
device_type;
-- TASK 2: KEY INSIGHTS & COSTS
-- Objective: Calculate the average refurbishment cost per device to set a baseline.
SELECT
device_type,
AVG(refurbishment_cost) AS avg_refurb_cost,
MAX(refurbishment_cost) AS max_refurb_cost
FROM
repurposed_devices_2024
WHERE
device_age_years < 6 -- Focusing on viable devices under 6 years
GROUP BY
device_type;
-- TASK 3: IDENTIFYING TRENDS & MAXIMIZING SUSTAINABILITY
-- Objective: Calculate CO2 Savings based on deployment region (Grid Intensity).
-- Note: Asia has higher grid intensity, meaning power savings there prevent more CO2.
SELECT
deployment_region,
COUNT(device_id) AS units_deployed,
SUM(estimated_co2_savings) AS total_co2_saved,
AVG(refurbishment_cost) AS avg_cost
FROM
repurposed_devices_2024
GROUP BY
deployment_region
ORDER BY
total_co2_saved DESC;
-- TASK 4: COST-EFFECTIVENESS INDEX (ADVANCED)
-- Objective: Identify which "Old" devices (>6 years) are actually worth saving.
-- Logic: We only want to save old devices if they are going to High-Intensity regions.
SELECT
device_id,
device_type,
device_age_years,
deployment_region,
(estimated_co2_savings / NULLIF(refurbishment_cost, 0)) AS cost_effectiveness_index
FROM
repurposed_devices_2024
WHERE
device_age_years > 6
AND deployment_region = 'Asia' -- Target high-impact grid
ORDER BY
cost_effectiveness_index DESC;