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
ExperiencesCoaching
New
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
Start free
Summarize Quick Visualization Library Usage
00:00
5 left

Summarize Quick Visualization Library Usage

EasySQL · PostgreSQL

Problem

What libraries do you reach for when you need to visualize data quickly?

For this SQL exercise, write a query that summarizes the libraries selected for quick visualization from the provided usage records. Return every library, including libraries with no qualifying usage.

Output

  1. One row per visualization library
  2. Columns: library_name, quick_use_count, and avg_setup_minutes
  3. Include only usage records marked for quick visualization in the metrics
  4. Sort by quick_use_count descending, average setup time ascending with nulls last, then library_name ascending

Output details

  • Round avg_setup_minutes to one decimal place.
  • Count qualifying records using non-NULL usage_id, producing 0 when none qualify.
  • Ignore NULL setup_minutes values when averaging, and return NULL when no qualifying setup time exists.
  • Treat catalog entries sharing library_name as separate libraries when their identifiers differ.

Schema

visualization_libraries
ColumnTypeDescription
library_idPKINTUnique identifier for a visualization library
library_nameVARCHAR(100)Display name of the visualization library
languageVARCHAR(30)Primary programming language associated with the library
visualization_library_usage
ColumnTypeDescription
usage_idPKINTUnique usage record identifier
library_idINTReferenced visualization library
analyst_nameVARCHAR(100)Analyst who selected the library
used_for_quick_vizBOOLEANWhether the library was selected for quick visualization
setup_minutesNUMERIC(6,2)Minutes needed to prepare the visualization
Tablesvisualization_librariesvisualization_library_usage
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.