Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL INNER JOIN Query
00:00
5 left

SQL INNER JOIN Query

EasySQL · PostgreSQL

Problem

Write a basic SQL query to retrieve data from two tables using an INNER JOIN.

Use the employees and departments tables. Return only employees assigned to a department that exists in the departments table.

Output

  1. One row per matching employee
  2. Columns: employee_id, employee_name, and department_name
  3. Sort by employee_id in ascending order

Schema

employees
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(100)Employee full name
department_idINTIdentifier of the employee's department
departments
ColumnTypeDescription
department_idPKINTUnique department identifier
department_nameVARCHAR(100)Department name
Tablesemployeesdepartments
Interviewer

Your question is SQL INNER JOIN Query. Start with the requirements and the two 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
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.