PROJECT 3
SQL CODESsales data
Skill Used:Data Retrieval (SELECT): Queried and extracted specific information from the database. Data Aggregation (SUM, COUNT): Calculated totals, such as sales and quantities, and counted records to analyze data trends. Data Filtering (WHERE, BETWEEN, IN, AND): Applied filters to select relevant data, including filtering by ranges and lists.
A manufacturing company is experiencing increasing workplace incident costs across multiple plant locations.
The operations team has requested a data analysis to:
Workplace Safety Data
Key fields include:
SELECT *
FROM [dbo].['Workplace Safety Data$']
WHERE PLANT='GEORGIA'
—
SELECT *
FROM [dbo].['Workplace Safety Data$']
WHERE [INCIDENT TYPE] <> 'fall'

SELECT *
FROM[dbo].['Workplace Safety Data$']
WHERE PLANT IN ('CALIFORNIA','FLORIDA')

SELECT *
FROM[dbo].['Workplace Safety Data$']
WHERE PLANT = 'CALIFORNIA' AND [INCIDENT COST]>1000

SELECT *
FROM[dbo].['Workplace Safety Data$']
WHERE PLANT = 'CALIFORNIA' OR [INCIDENT COST]>1000
—
select [Plant]
,[Gender]
,avg([Incident Cost]) as avg_incident_cost
,sum([Incident Cost]) as total_incident_cost
,count(*) as number_of_incident
from[dbo].['Workplace Safety Data$']
group by [Plant]
,[Gender]
having plant in ('alabama','california','georgia')
order by[Plant] asc
—
with incident_rank as
(
select *
,rank () over( partition by[Plant] order by [Incident Cost] desc) as rank
from[dbo].['Workplace Safety Data$']
)
select*
from incident_rank
where rank=1
—
This project demonstrates the use of SQL to analyze workplace safety data and extract meaningful business insights. By applying filtering, aggregation, window functions, and conditional logic, key patterns in incident occurrence and cost distribution were identified.
The analysis highlights that incident costs vary significantly across plants and demographic groups, with certain locations consistently showing higher risk levels. High-cost incidents were successfully isolated and ranked, providing visibility into the most critical safety concerns.
Overall, this project shows how SQL can be used not just for querying data, but for supporting data-driven decision-making. The insights generated can help organizations prioritize safety improvements, reduce incident costs, and enhance operational efficiency.