Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Write a Basic SQL Extraction

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

Your question is Write a Basic SQL Extraction. Start with the requirements and the one table 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

What is your experience with SQL, and can you write a query to extract specific data?

Use the provided orders table. Write a query that returns completed orders with an amount greater than 100.

Output

  1. One row per qualifying order, with order_id, customer_name, amount, and order_date
  2. Exclude non-completed orders and orders with amounts of 100 or less
  3. Order by amount descending, with order_id ascending as the tie-breaker

Schema

orders
ColumnTypeDescription
order_idPKINTUnique order identifier
customer_nameVARCHAR(100)Customer name
statusVARCHAR(20)Order status
amountDECIMAL(10,2)Order amount
order_dateDATEDate the order was placed
Tablesorders
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results