Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
SQL Data Structure Review
00:00
5 left

SQL Data Structure Review

HardSQL · PostgreSQL

Problem

Tell me about how you would review SQL data structures for correctness and performance.

Using the supplied PostgreSQL metadata snapshot, identify tables that need structural or performance review. Include key metadata and scan statistics so the findings can be investigated.

Output

  1. One row per table requiring review.
  2. Include table_name, correctness and performance statuses, primary-key counts, and scan counts.
  3. Sort alphabetically by table_name.

Schema

schema_tables
ColumnTypeDescription
table_idPKINTMetadata table identifier
table_nameVARCHAR(100)Name of the reviewed table
row_countBIGINTEstimated number of rows
requires_primary_keyBOOLEANWhether the table is expected to have a primary key
schema_columns
ColumnTypeDescription
column_idPKINTMetadata column identifier
table_idINTReferenced table metadata identifier
column_nameVARCHAR(100)Reviewed column name
is_primary_keyBOOLEANWhether the column belongs to the primary key
is_nullableBOOLEANWhether the column permits null values
query_scan_stats
ColumnTypeDescription
stat_idPKINTScan-statistics record identifier
table_idINTReferenced table metadata identifier
sequential_scansBIGINTObserved sequential scan count
index_scansBIGINTObserved index scan count
Tablesschema_tablesschema_columnsquery_scan_stats
Interviewer

Your question is SQL Data Structure Review. Start with the requirements and the three 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.