Workspace
Josue Sosa/

Project: Analyzing Students' Mental Health in SQL

0
Beta
Spinner

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, and that social connectedness (belonging to a social group) and acculturative stress (stress associated with joining a new culture) are predictive of depression.

Here is a data description of the columns you may find helpful.

Field NameDescription
inter_domTypes of students (international or domestic)
japanese_cateJapanese language proficiency
english_cateEnglish language proficiency
academicCurrent academic level (undergraduate or graduate)
ageCurrent age of student
stayCurrent length of stay in years
todepTotal score of depression (PHQ-9 test)
toscTotal score of social connectedness (SCS test)
toasTotal score of acculturative stress (ASISS test)
Hidden code df2
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

Here is just the counts for international students.(201 / 70.28%)

Unknown integration
DataFrameavailable as
df1
variable
[17]
SELECT 
    COUNT(*) AS total_count, 
    SUM(CASE WHEN inter_dom = 'Inter' THEN 1 ELSE 0 END) AS count_inter,
    ROUND((SUM(CASE WHEN inter_dom = 'Inter' THEN 1 ELSE 0 END) * 100 / COUNT(*)), 3) AS count_inter_percentage
FROM 'students.csv'
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

The statistics for international students.(201)

Hidden code df5
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

The statistics for all students.(286 students)

  • We can see the data shows zero to little differentiation in these scores between international and domestic students.
Hidden code students
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

Here I wanted to see if there was a trend.

  • As the table below shows there are no correlation with mental health and length of stay abroad.
  • These #s do fluctuate meaning there are variables that are influencing mental health but are not accounted for.
Unknown integration
DataFrameavailable as
df
variable
SELECT 
AVG(stay) AS stay, 
ROUND(AVG(todep),2) AS average_phq, 
ROUND(AVG(tosc),2) AS average_scs, 
ROUND(AVG(toas),2) AS average_as
FROM 'students.csv'
WHERE inter_dom = 'Inter'
	AND stay IS NOT NULL
GROUP BY stay
ORDER BY stay DESC;
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

Here we have the correlations between stay and mental health.

  1. Depression:
  • The coefficient is positive (0.0516), indicating a slight increase in the depression score with each additional year of stay.
  1. Social Connectedness:
  • The coefficient is negative (-0.0376), suggesting that social connectedness scores tend to decrease slightly with each additional year of stay.
  1. Acculturative Stress:
  • The coefficient is positive (0.0002), indicating a insignificant increase in acculturative stress with each additional year of stay.
Unknown integration
DataFrameavailable as
df3
variable
SELECT	
ROUND(CORR(stay, todep),4) AS correlation_stay_todep, 
ROUND(CORR(stay, tosc),4) AS correlation_stay_tosc,
ROUND(CORR(stay, toas),4) AS correlation_stay_toas
FROM 'students.csv'
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.

The correlations between stay and other variables

The strongest correlations with stay are related to age and Japanese language proficiency.

  • This means that as students spend more time, they grow older and they also improve their language skills.
Unknown integration
DataFrameavailable as
df4
variable
SELECT 
ROUND(CORR(stay, japanese),4) AS correlation_stay_jap,
ROUND(CORR(stay, age_cate),4) AS correlation_stay_age_cate,
ROUND(CORR(stay, age), 4) AS correlation_stay_age

FROM 'students.csv'
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.



  • AI Chat
  • Code