Skip to content
Project: Analyzing Students' Mental Health in SQL
Does going to university in a different country affect your mental health? A Japanese international university surveyed its students in 2018 and published a study the following year that was approved by several ethical and regulatory boards.
The study found that international students have a higher risk of mental health difficulties than the general population. Explore the students
data using PostgreSQL to find out if this is true and see if the length of stay is a contributing factor.
Here is a data description of the fields you may find helpful. The full dataset is in one table with 50 fields and, according to the survey, 268 records. Each row is a student.
Field Name | Description |
---|---|
inter_dom | Types of students |
japanese_cate | Japanese language proficiency |
english_cate | English language proficiency |
academic | Current academic level |
age | Current age of student |
stay | Current length of stay in years |
todep | Total score of depression (PHQ-9 test) |
tosc | Total score of social connectedness (SCS test) |
toas | Total score of Acculturative Stress (ASISS test) |
Your task will be to do the following exploratory analysis:
- Count the number of all records, and all records per student type
- Filter the data to see how it differs between the student types
- Find the summary statistics of the diagnostic tests for all students
- Summarize the data for international students
- See if length of stay impacts the test scores
DataFrameas
df
variable
-- Count the number of all records, and all records per student type
SELECT count(*) as countall, count(distinct inter_dom) as countstudenttype
FROM students
DataFrameas
df1
variable
--Filter the data to see how it differs between the student types
select inter_dom,
round(avg(todep), 2) as Depression_Avg,
round(max(todep),2) as Max_Depression,
round(avg(tosc),2) as Social_Connectedness_Avg,
round(avg(toas),2) as Acculturative_Stress_Avg,
count(CASE WHEN 'yes' THEN suicide END) as suicide_count
from students
where inter_dom is not null
and todep is not null
and tosc is not null
and toas is not null
group by inter_dom
order by Depression_Avg Desc;
--It appears that while Domestic Students on average are slightly more depressed than their International peers, the International students are significantly more stressed.
-- Depression does not seem to be as impactful on suicide as stress
DataFrameas
df2
variable
--Find the summary statistics of the diagnostic tests for all students
select inter_dom,
japanese_cate,
round(avg(amiscell),2) as Amiscell_Avg,
round(avg(acs),2) as ACs_avg,
round(avg(aph),2) as aph_Avg,
round(avg(apd),2) as apd_avg,
round(avg(partner),2)+round(avg(friends),2)+round(avg(parents),2)+round(avg(relative),2)+
round(avg(profess),2)+round(avg(reli),2) as social_support_avg,
count(CASE WHEN 'yes' THEN suicide END) as suicide_count,
round(avg(todep), 2) as Depression_Avg,
round(avg(tosc),2) as Social_Connectedness_Avg,
round(avg(toas),2) as Acculturative_Stress_Avg
from students
where amiscell is not null
group by inter_dom, japanese_cate;
-- Amiscell is the statistical summary number assigned by researchers. Using the info that was stated in the project notes, I know that researchers found that International students struggled the most with mental health. When Amiscell was placed in to descending order, it showed that Int'l students with lower Japanese comprehension skills struggled the most. The data was consistent among suicides, social connectedness, and stress.
DataFrameas
df4
variable
--Summarize the data for international students
SELECT
inter_dom,
COUNT(CASE WHEN suicide='Yes' THEN 'YES' END) as suicide_yes,
gender,
stay_cate,
japanese_cate
FROM students
WHERE inter_dom = 'Inter' AND suicide = 'Yes' AND gender = 'Female'
GROUP BY inter_dom, gender, stay_cate, japanese_cate
ORDER BY suicide_yes desc;
DataFrameas
df3
variable
select *
from students