Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
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 feedbackCoaching1:1 coaching with people at your target companiesSuccess 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
Lead Data Governance for Multi-Tenant
00:00
5 left

Lead Data Governance for Multi-Tenant

HardSQL · PostgreSQL

Problem

How do you approach designing a lead data governance architecture for a multi-tenant enterprise environment?

For the SQL implementation, produce a tenant-level governance view that identifies consent coverage, latest quality failures, duplicate lead groups, and missing policy coverage.

Output

  1. One row per tenant, including tenants without leads or policies.
  2. Columns: tenant_name, active_leads, consented_active_leads, consent_rate_pct, failed_latest_quality_leads, duplicate_email_groups, governance_status.
  3. Sort by tenant_id ascending. Treat only the most recent consent and quality event for each lead as current.

Schema

tenants
ColumnTypeDescription
tenant_idPKINTTenant identifier
tenant_nameVARCHAR(100)Tenant display name
regionVARCHAR(30)Tenant operating region
leads
ColumnTypeDescription
lead_idPKINTLead identifier
tenant_idINTOwning tenant identifier
emailVARCHAR(255)Lead email address
lead_statusVARCHAR(20)Current lead lifecycle status
created_atDATELead creation date
lead_consent
ColumnTypeDescription
consent_idPKINTConsent event identifier
lead_idINTRelated lead identifier
consent_statusVARCHAR(20)Consent decision
recorded_atTIMESTAMPConsent event timestamp
lead_quality_events
ColumnTypeDescription
quality_event_idPKINTQuality event identifier
lead_idINTRelated lead identifier
quality_statusVARCHAR(20)Quality validation result
checked_atTIMESTAMPQuality check timestamp
governance_policies
ColumnTypeDescription
policy_idPKINTPolicy identifier
tenant_idINTPolicy tenant identifier
policy_versionVARCHAR(20)Policy version label
effective_fromDATEPolicy effective date
is_activeBOOLEANWhether the policy is active
Tablestenantsleadslead_consentlead_quality_eventsgovernance_policies
Interviewer

Your question is Lead Data Governance for Multi-Tenant. Start with the requirements and the five 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.