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 Name | Description |
|---|---|
inter_dom | Types of students (international or domestic) |
japanese_cate | Japanese language proficiency |
english_cate | English language proficiency |
academic | Current academic level (undergraduate or graduate) |
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) |
---Explore how the length of stay impacts the mental health of international students
SELECT stay,
COUNT(inter_dom) AS count_int,
ROUND(AVG(todep),2) AS average_phq,
ROUND(AVG(tosc),2) AS average_scs,
ROUND(AVG(toas),2) AS average_as
FROM students
WHERE inter_dom = 'Inter'
GROUP BY stay
ORDER BY stay DESC;SELECT stay,
COUNT(inter_dom) AS count_int,
ROUND(AVG(todep),2) AS average_phq,
ROUND(AVG(tosc),2) AS average_scs,
ROUND(AVG(toas),2) AS average_as
FROM students
WHERE inter_dom = 'Inter'
GROUP BY stay
HAVING COUNT(inter_dom) > 6
ORDER BY stay DESC;SELECT *
FROM students
WHERE inter_dom='Dom';
SELECT stay,
COUNT(inter_dom) AS count_int,
ROUND(AVG(todep),2) AS average_phq,
ROUND(AVG(tosc),2) AS average_scs,
ROUND(AVG(toas),2) AS average_as
FROM students
WHERE gender = 'Male'
GROUP BY stay
ORDER BY stay DESC;
SELECT stay,
COUNT(inter_dom) AS count_int,
ROUND(AVG(todep),2) AS average_phq,
ROUND(AVG(tosc),2) AS average_scs,
ROUND(AVG(toas),2) AS average_as
FROM students
WHERE gender = 'Female'
GROUP BY stay
ORDER BY stay DESC;
with gen_F AS (SELECT stay,
COUNT(inter_dom) AS count_int,
ROUND(AVG(todep),2) AS average_phq,
ROUND(AVG(tosc),2) AS average_scs,
ROUND(AVG(toas),2) AS average_as
FROM students
WHERE gender = 'Female'),
gen_M AS (SELECT stay,
COUNT(inter_dom) AS count_int,
ROUND(AVG(todep),2) AS average_phq,
ROUND(AVG(tosc),2) AS average_scs,
ROUND(AVG(toas),2) AS average_as
FROM students
WHERE gender = 'Male')
SELECT stay, gen_F.count_in, gen_M.count_in
FROM students
WHERE academic = 'grad'
GROUP BY students.stay
ORDER BY students.stay DESC;1 hidden cell
SELECT
corr(todep, tosc) AS correlation_depression_social_connectedness,
corr(todep, toas)AS correlation_depression_acculturative_stress
FROM students;-- Regression
SELECT regr_slope(todep, stay) AS slope,
regr_intercept(todep, stay) AS intercept,
regr_r2(todep, stay) AS r_squared
FROM students;SELECT avg(todep) AS mean_depression,
stddev(todep) AS stddev_depression,
min(todep) AS min_depression,
max(todep) AS max_depression,
avg(tosc) AS mean_social_connectedness,
stddev(tosc) AS stddev_social_connectedness,
min(tosc) AS min_social_connectedness,
max(tosc) AS max_social_connectedness,
avg(toas) AS mean_acculturative_stress,
stddev(toas) AS stddev_acculturative_stress,
min(toas) AS min_acculturative_stress,
max(toas) AS max_acculturative_stress
FROM students;# The % operator in Python is the modulus operator.
# It returns the remainder of the division of the left-hand operand by the right-hand operand.
# In this case, 3 divided by 7 is 0 with a remainder of 3.
# Therefore, 3 % 7 will return 3.
result = 3 % 7
result