
Interactive Dashboard In Tableau Using SQL Queries
Motivation
As a psychology major, substance use disorder and how that continues to affect the United States has always been extremely fascinating to me. After finding the dataset on Connecticut overdoses from the years 2012 - 2018 while scrolling through Kaggle.com, I couldn't help but throw it into SQL server and Tableau and try to discover some findings that would help myself and hopefully, others better understand this epidemic that is affecting a lot of people.
Queries in SQL
The average age of overdoses
SELECT ROUND(AVG(Age)) AS Average_Age_OD
FROM drug_Death.DrugDeathCT;
The number of overdoses from 2012-2018
SELECT COUNT(DISTINCT ID) AS Number_Of_Overdoses
FROM drug_Death.DrugDeathCT;
The number of overdoses in each Connecticut city
SELECT COUNT(DISTINCT ID) AS OverdoseByCity, DeathCity
FROM drug_Death.DrugDeathCT
GROUP BY DeathCity
ORDER BY OverdoseByCity DESC;
The top 5 drugs causing the most overdoses
--Heroin
SELECT COUNT(Heroin) AS ODs_By_Heroin FROM drug_Death.DrugDeathCT
WHERE Heroin = 1;
--Cocaine
SELECT COUNT(Cocaine) AS ODs_By_Cocaine, FROM drug_Death.DrugDeathCT
WHERE Cocaine = 1;
--Fentanyl
SELECT COUNT(*) AS ODs_By_Fentanyl FROM drug_Death.DrugDeathCT
WHERE Fentanyl_Analogue = 1;
--Oxycodone
SELECT COUNT(*) AS ODs_By_Oxycodone FROM drug_Death.DrugDeathCT
WHERE Oxycodone = 1;
--Oxymorphone
SELECT COUNT(*) AS ODs_By_Oxymorphone FROM drug_Death.DrugDeathCT
WHERE Oxymorphone = 1;
--Alcohol
SELECT COUNT(*) AS ODs_By_Alcohol FROM drug_Death.DrugDeathCT
WHERE Ethanol = 1;
--Hydrocodone
SELECT COUNT(*) AS ODs_By_Hydrocodone FROM drug_Death.DrugDeathCT
WHERE Hydrocodone = 1;
--Benzodiazepine
SELECT COUNT(*) AS ODs_By_Benzodiazepines FROM drug_Death.DrugDeathCT
WHERE Benzodiazepine = 1;
--Methadone
SELECT COUNT(*) AS ODs_By_Methadone FROM drug_Death.DrugDeathCT
WHERE Methadone= 1;
The number of overdoses by each race
SELECT COUNT(DISTINCT ID) AS OverdoseByRace, Count(Race), Race
FROM drug_Death.DrugDeathCT
WHERE Race is not null
GROUP BY Race
ORDER BY OverdoseByRace DESC;
Findings
After writing these queries, running them, and analyzing the results, we can state the findings which can be seen in the Tableau dashboard at the top of the page or here (this link will take you to the tableau dashboard where the interactive map can be used). The main findings were that the average age of overdoses in the state of Connecticut was 42 years old, 5,103 overdoses had occurred, the city of Hartford had the most overdoses by about 200, heroin caused the most overdoses with fentanyl being a close second, and white people were far more likely to overdose in the state of Connecticut than any other race.
Actions
Now that the data has been cleaned, explored, and analyzed the most important part is to take action on these findings. What a stakeholder could do is use these statistics to create programs that try to lessen drug use in the communities that are most affected, like middle-aged white individuals.