Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Meta SQL: Author Domain Pattern

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

Your question is Meta SQL: Author Domain Pattern. 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

Meta's creator publishing analytics team wants to identify prolific authors and measure how many registered authors have websites associated with the meta.com domain. Write a PostgreSQL query using the authors and books tables.

Requirements

  1. Return every author who has published at least five books.
  2. Include the author's name and book count.
  3. Calculate the percentage of all registered authors whose non-null personal website URL contains meta.com, ignoring letter case.
  4. Include that percentage in the result for each qualifying author, rounded to two decimal places. Sort by book count descending, then author name ascending.

Schema

authors
ColumnTypeDescription
author_idPKINTUnique author identifier
author_nameVARCHAR(100)Author's display name
is_registeredBOOLEANWhether the author is registered
website_urlVARCHAR(255)Personal website URL
books
ColumnTypeDescription
book_idPKINTUnique book identifier
author_idINTReferences authors.author_id
titleVARCHAR(200)Published book title
Tablesauthorsbooks
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results