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. 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 NameDescription
inter_domTypes of students
japanese_cateJapanese language proficiency
english_cateEnglish language proficiency
academicCurrent academic level
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)

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
Spinner
DataFrameas
df
variable
-- Start coding here...
SELECT *
FROM students;
Spinner
DataFrameas
df1
variable
SELECT inter_dom
FROM students
WHERE inter_dom LIKE 'Inter%';
Spinner
DataFrameas
df2
variable
SELECT inter_dom
FROM students
WHERE inter_dom NOT LIKE 'Inter';
Spinner
DataFrameas
df3
variable
SELECT COUNT(inter_dom)
FROM students
WHERE inter_dom = 'Inter';
Spinner
DataFrameas
df4
variable
SELECT min(todep) AS min_phq
FROM students 
WHERE inter_dom = 'Inter' and todep IS NOT NULL;
Spinner
DataFrameas
df5
variable
SELECT max(todep) AS max_phq
FROM students
WHERE inter_dom = 'Dom'
Spinner
DataFrameas
df6
variable
SELECT ROUND(avg(todep), 2)
FROM students
WHERE inter_dom = 'Inter';
Spinner
DataFrameas
df7
variable
SELECT ROUND(avg(todep), 2) AS avg_phq
FROM students
WHERE inter_dom = 'Dom';
Spinner
DataFrameas
df8
variable
SELECT 
Spinner
DataFrameas
df9
variable
SELECT min(tosc) AS min_social,
max(tosc) AS max_social,
ROUND(AVG (tosc), 2) AS avg_social
FROM students 
WHERE inter_dom = 'Inter' ;
Spinner
DataFrameas
df10
variable
SELECT min(tosc) AS min_social,
max(tosc) AS max_social,
ROUND(AVG (tosc), 2) AS avg_social
FROM students 
WHERE inter_dom = 'Dom' ;
Spinner
DataFrameas
df11
variable
SELECT min(toas) AS min_stress,
max(toas) AS max_stress,
ROUND(AVG (toas), 2) AS avg_stress
FROM students 
WHERE inter_dom = 'Inter' ;
Spinner
DataFrameas
df12
variable
SELECT min(toas) AS min_stress,
max(toas) AS max_stress,
ROUND(AVG (toas), 2) AS avg_stress
FROM students 
WHERE inter_dom = 'Dom' ;
Spinner
DataFrameas
df13
variable
SELECT min(todep) AS min_phq,
       max(todep) AS max_todep,
	   round(avg(todep),2) AS avg_todep,
	   min(tosc) AS min_social, 
	   max(tosc) AS max_social,
	   round(avg(tosc), 2) AS avg_social,
	   min(toas) AS min_stress, 
	   max(toas) AS max_stress,
	   round(avg(toas), 2) AS avg_stress
FROM students
WHERE inter_dom = 'Inter'
GROUP BY inter_dom
;