Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Join Query With Filters
00:00
5 left

Join Query With Filters

EasySQL · PostgreSQL

Problem

Write a basic SQL query to join two tables (for example Users and Archives) and filter the results by a specific date range and status code.

Use the provided users and archives tables. Return matching active archives created during January 2025.

Output

  1. Return one row per matching archive with user_id, user_name, archive_id, archive_title, archived_at, and status_code.
  2. Order rows by archived_at ascending, then archive_id ascending.

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
user_nameVARCHAR(100)Display name of the user
emailVARCHAR(255)User email address
archives
ColumnTypeDescription
archive_idPKINTUnique archive identifier
user_idINTUser associated with the archive
archive_titleVARCHAR(150)Title of the archived item
archived_atTIMESTAMPTimestamp when the item was archived
status_codeVARCHAR(20)Current archive status
Tablesusersarchives
Interviewer

Your question is Join Query With Filters. 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.