Skip to content

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.

Explore the students data using PostgreSQL to find out if you would come to a similar conclusion for international students and see if the length of stay is a contributing factor.

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)
Spinner
DataFrameas
students
variable
-- Run this code to view the data in students
SELECT * 
FROM students;
Spinner
DataFrameas
df
variable
SELECT inter_dom, COUNT(*) AS student_count
FROM students
GROUP BY inter_dom;
Spinner
DataFrameas
df1
variable
SELECT 
  CASE 
    WHEN inter_dom = '0' OR inter_dom = 'Dom' THEN 'Domestic'
    WHEN inter_dom = '1' OR inter_dom = 'Inter' THEN 'International'
    ELSE 'Other'
  END AS student_type, 
  COUNT(*) AS student_count
FROM students
GROUP BY student_type;
Spinner
DataFrameas
df2
variable

SELECT 
  CASE 
    WHEN inter_dom = '0' OR inter_dom = 'Dom' THEN 'Domestic'
    WHEN inter_dom = '1' OR inter_dom = 'Inter' THEN 'International'
    ELSE 'Other'
  END AS student_type,
  AVG(todep) AS avg_depression_score
FROM students
GROUP BY student_type;

Step 2: Compare Mental Health Outcomes Between Groups Once you’ve standardized the student types, you can start comparing their mental health data, like depression scores. For example, to compare average depression scores:

Step 3: Investigate Impact of Length of Stay for International Students If you want to focus on international students and see how length of stay affects depression, you can filter out the international students and group by the length of stay (stay column):

Spinner
DataFrameas
df3
variable
SELECT stay, AVG(todep) AS avg_depression_score
FROM students
WHERE inter_dom = '1' OR inter_dom = 'Inter'  -- only international students
GROUP BY stay
ORDER BY stay;

This will help you analyze whether the length of stay in a foreign country has any noticeable impact on depression scores for international students.

  1. Check the Correlation: To be more confident in your observation, it’s important to first verify if there is a consistent trend in your data. If you're seeing that as the stay (length of stay) increases, the todep (depression score) also increases, then you likely have a correlation.

You could write a query to calculate the average depression score by the length of stay and visually inspect the trend:

Spinner
DataFrameas
df4
variable
SELECT stay, AVG(todep) AS avg_depression_score
FROM students
WHERE inter_dom = '1' OR inter_dom = 'Inter'  -- only international students
GROUP BY stay
ORDER BY stay;
Spinner
DataFrameas
df5
variable
SELECT CORR(stay, todep) AS correlation
FROM students
WHERE inter_dom = '1' OR inter_dom = 'Inter';