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
Designing a Network and SQL Diagram
00:00
5 left

Designing a Network and SQL Diagram

HardSQL · PostgreSQL

Problem

Describe a system you work with using a diagram, including network layers and where SQL fits in.

Use the supplied architecture metadata to produce the rows needed to render the diagram. Include every component, even components without outgoing connections, and identify the SQL placement for each component.

Output

  1. One row per component and outgoing connection, plus one row for an isolated component
  2. Columns: source_component, source_layer, source_sql_location, protocol, port, target_component, target_layer, target_sql_location
  3. Include all components and order by network-layer sequence, component ID, then connection ID, with isolated components last within their layer

Schema

architecture_nodes
ColumnTypeDescription
node_idPKINTUnique architecture component identifier
node_nameVARCHAR(100)Component name shown in the diagram
layerVARCHAR(30)Network or system layer
node_typeVARCHAR(30)Component type
sql_roleVARCHAR(100)Description of the component's SQL responsibility
architecture_links
ColumnTypeDescription
link_idPKINTUnique connection identifier
source_node_idINTOriginating component
target_node_idINTReceiving component
protocolVARCHAR(20)Connection protocol
portINTNetwork port used by the connection
Tablesarchitecture_nodesarchitecture_links
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.