Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Joins
00:00
5 left

SQL Joins

EasySQL · PostgreSQL

Problem

What are the different types of SQL joins?

Asked in the Screening Round stage. This was an opening SQL fundamentals question in the 15-minute screening call.

Using the supplied employees and departments tables, write a query that demonstrates common join types by returning the number of rows produced by each one.

Output

  1. One row per join type, with columns join_type and row_count.
  2. Include INNER, LEFT, RIGHT, FULL OUTER, and CROSS joins.
  3. Order alphabetically by join_type.

Schema

employees
ColumnTypeDescription
employee_idPKINTUnique employee identifier
employee_nameVARCHAR(100)Employee name
department_idINTEmployee department identifier
departments
ColumnTypeDescription
department_idPKINTUnique department identifier
department_nameVARCHAR(100)Department name
Tablesemployeesdepartments
Interviewer

Your question is SQL Joins. 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.