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
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
Get started
IAM and Data Access Controls
00:00
5 left

IAM and Data Access Controls

HardSQL · PostgreSQL

Problem

What security best practices do you implement for IAM and data access control?

Write a SQL query that audits active access grants for active principals as of 2025-01-01. Include only high or critical sensitivity assets, and flag administrator grants or grants issued at least 90 days before the as-of date.

Output

  1. One row per qualifying access grant with the principal, asset, role, grant date, sensitivity, and review priority.
  2. Exclude inactive principals, revoked grants, non-sensitive assets, and recent non-administrator grants.
  3. Order by review priority, then principal name and asset name.

Schema

iam_principals
ColumnTypeDescription
principal_idPKINTUnique identity identifier
principal_nameVARCHAR(100)Human or service identity name
principal_typeVARCHAR(20)Identity type such as human or service
statusVARCHAR(20)Current identity status
role_grants
ColumnTypeDescription
grant_idPKINTUnique grant identifier
principal_idINTGranted identity
asset_idINTProtected data asset
role_nameVARCHAR(30)Assigned access role
granted_atDATEDate the grant was issued
revoked_atDATEDate the grant was revoked
data_assets
ColumnTypeDescription
asset_idPKINTUnique protected asset identifier
asset_nameVARCHAR(100)Protected dataset or system name
sensitivityVARCHAR(20)Data sensitivity classification
owner_teamVARCHAR(60)Team responsible for the asset
Tablesiam_principalsrole_grantsdata_assets
Interviewer

Your question is IAM and Data Access Controls. 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.