Workspace
Blessing Ezenwadiugwu/

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. 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
Unknown integration
DataFrameavailable as
df
variable
-- Start coding here...
SELECT *
FROM students;
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df4
variable
select inter_dom, japanese_cate, english_cate, academic, age, stay, todep, tosc, toas
from students
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df1
variable
SELECT COUNT(*) as total_records
FROM students
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df2
variable
SELECT DISTINCT inter_dom, count(*) AS count_inter_dom
from students
group by inter_dom
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df9
variable
select 
	inter_dom, 
	japanese_cate, 
	count(japanese_cate) as no_of_jap_cate, 
	round(avg(todep),2) as avg_todep, 
	round(avg(tosc),2) as avg_tosc, 
	round(avg(toas),2) as avg_toas
from students
group by inter_dom, japanese_cate
order by inter_dom desc
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df10
variable
select 
	inter_dom, 
	english_cate, 
	count(english_cate) as no_of_eng_cate, 
	round(avg(todep),2) as avg_todep, 
	round(avg(tosc),2) as avg_tosc, 
	round(avg(toas),2) as avg_toas
from students
group by inter_dom, english_cate
order by inter_dom desc
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df11
variable
select 
	inter_dom, 
	academic, 
	count(academic) as no_of_academic, 
	round(avg(todep),2) as avg_todep, 
	round(avg(tosc),2) as avg_tosc, 
	round(avg(toas),2) as avg_toas
from students
group by inter_dom, academic
order by inter_dom desc
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df13
variable
select min(todep) as min_phq, max(todep) as max_phq, round(avg(todep),2) as avg_phq
from students
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df12
variable
select min(tosc) as min_tosc, max(tosc) as max_tosc, 
round(avg(tosc),2) as avg_tosc
from students
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df14
variable
select min(toas) as min_toas, max(toas) as max_toas, 
round(avg(toas),2) as avg_toas
from students
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
Unknown integration
DataFrameavailable as
df3
variable
select
	stay,
	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
This query is taking long to finish...Consider adding a LIMIT clause or switching to Query mode to preview the result.
  • AI Chat
  • Code