Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Query for Teacher Criteria

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is SQL Query for Teacher Criteria. Start with the requirements and the three tables on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

i2c Academy wants to identify experienced instructors who teach a broad programming curriculum. Write a PostgreSQL query to display teachers older than 60 who teach more than three distinct programming courses.

Requirements

  1. Join the teacher, course assignment, and course tables.
  2. Keep only teachers whose age is greater than 60 and courses categorized as Programming.
  3. Count distinct programming courses per teacher.
  4. Return the teacher name and course count, ordered alphabetically by teacher name.

Schema

teachers
ColumnTypeDescription
teacher_idPKINTUnique teacher identifier
teacher_nameVARCHAR(100)Teacher's full name
ageINTTeacher's age in years
teacher_courses
ColumnTypeDescription
assignment_idPKINTUnique teaching assignment identifier
teacher_idINTReferences teachers.teacher_id
course_idINTReferences courses.course_id
courses
ColumnTypeDescription
course_idPKINTUnique course identifier
course_nameVARCHAR(150)Course title
course_categoryVARCHAR(50)Course classification
Tablesteachersteacher_coursescourses
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results