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
Securing Sensitive Data
00:00
5 left

Securing Sensitive Data

HardSQL · PostgreSQL

Problem

How would you handle permissions and security on sensitive data sets?

Translate the access policy into a PostgreSQL query that returns only currently authorized dataset grants. Sensitive datasets require an active user, enabled MFA, and an approved security role. Standard datasets require only an active user and a valid grant.

Output

  1. One row per authorized grant
  2. Columns: email, dataset_name, classification, permission_level, granted_role, and access_scope
  3. Exclude inactive users, inactive datasets, revoked grants, expired grants, and unauthorized sensitive access
  4. Order by email, then dataset_name

Schema

users
ColumnTypeDescription
user_idPKINTUnique user identifier
emailVARCHAR(255)User email address
roleVARCHAR(50)User security role
is_activeBOOLEANWhether the user account is active
mfa_enabledBOOLEANWhether multi-factor authentication is enabled
datasets
ColumnTypeDescription
dataset_idPKINTUnique dataset identifier
dataset_nameVARCHAR(150)Dataset name
classificationVARCHAR(30)Data classification such as public, internal, restricted, or secret
owner_teamVARCHAR(100)Team responsible for the dataset
is_activeBOOLEANWhether the dataset is available
access_grants
ColumnTypeDescription
grant_idPKINTUnique grant identifier
user_idINTUser receiving the grant
dataset_idINTDataset covered by the grant
permission_levelVARCHAR(30)Granted access level
granted_roleVARCHAR(50)Role recorded when access was granted
revoked_atDATEDate the grant was revoked
expires_atDATEGrant expiration date
Tablesusersdatasetsaccess_grants
Interviewer

Your question is Securing Sensitive Data. 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.