Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
SQL Whiteboarding and Coding
00:00
5 left

SQL Whiteboarding and Coding

MediumSQL · PostgreSQL

Problem

Tell me about how you would approach a SQL whiteboarding problem and a separate coding problem under time pressure.

For the SQL portion, use the supplied users and posts tables. Write a query that demonstrates a clear, verifiable approach without including users who do not meet the required post threshold.

Output

  1. One row per user with at least two published posts
  2. Columns: user_id, username, published_post_count, and latest_published_at
  3. Sort by published_post_count descending, then username ascending, with NULL usernames last

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
usernameVARCHAR(50)Displayed username
created_atTIMESTAMPUser creation timestamp
posts
ColumnTypeDescription
post_idPKINTUnique post identifier
user_idINTUser who created the post
titleVARCHAR(120)Post title
statusVARCHAR(20)Post publication status
created_atTIMESTAMPPost creation timestamp
Tablesusersposts
Interviewer

Your question is SQL Whiteboarding and Coding. 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.