Question 10 - Calculating student attendance using SQL


The following data science interview question is testing for your ability to interpret a 'real life' dataset and quickly extract an insight. This particular question asks for a solution in SQL, but it would also be common to solve this in Python or R.

Given the following table schemas, how would you figure out the overall attendance rate for each grade on 2018-03-12?

Table 1: student_attendance_log

Column Name Data Type Description
date string date of log per student_id, format is 'yyyy-mm-dd'
student_id integer id of the student
attendance_status string Possible values are ['present', 'tardy', 'absent']

Table 2: student_demographic

Column Name Data Type Description
student_id integer id of the student
grade_level integer will be a value between 0-12, which corresponds
date_of_birth string Student birth date, format is 'yyyy-mm-dd'




Ace your next data science interview

Get better at data science interviews by solving a few questions per week