Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Top 10 IDs Query

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

Your question is Top 10 IDs Query. Start with the requirements and the two 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

Business Context

First American Financial uses title order records and property data to support title and settlement workflows. An operations dashboard needs the highest order IDs from currently valid, completed orders.

Task

Write a PostgreSQL query that returns the top 10 title_order_id values in descending order. Include only completed title orders linked to active properties.

Requirements

  1. Join title_orders to properties using property_id.
  2. Filter for completed orders and active properties.
  3. Return only title_order_id, sorted descending, with at most 10 rows.

Schema

title_orders
ColumnTypeDescription
title_order_idPKINTUnique title order identifier
property_idINTRelated property identifier
order_statusVARCHAR(20)Current title order status
properties
ColumnTypeDescription
property_idPKINTUnique property identifier
property_nameVARCHAR(100)Property label
is_activeBOOLEANWhether the property is active
Tablestitle_ordersproperties
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results