Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
SQL Query for Teacher Criteria
00:00
5 left

SQL Query for Teacher Criteria

EasySQL · PostgreSQL

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
Interviewer

Your question is SQL Query for Teacher Criteria. Start with the requirements and the three tables in the Question tab.

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.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.