Count Sensitive Files With Active Public Links per Folder

Last updated: November 29, 2026

Quick Overview

Given tables of files, classification labels with confidence scores, and share events with optional revocation times, write SQL that returns the ten folders containing the most files that are both sensitive (PII, PHI or PCI at confidence of at least 0.8) and still have an unrevoked public link.

Concentric Ai
Data Manipulation (SQL/Python)
Data Engineer
Concentric Ai
November 29, 2026
Data Engineer
Technical Screen
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


Given tables of files, classification labels with confidence scores, and share events with optional revocation times, write SQL that returns the ten folders containing the most files that are both sensitive (PII, PHI or PCI at confidence of at least 0.8) and still have an unrevoked public link.

Concentric AI's risk views roll up exposure by location so a security team knows where to remediate first. This screen checks whether a candidate avoids double counting across one-to-many joins and handles revoked shares correctly.

What the Interviewer Expects
  • De-duplicate files that carry several labels or several links
  • Filter out revoked shares with IS NULL, not equality
  • Apply the confidence threshold before joining
  • Order deterministically with a tie-break
  • Verify the result against a tiny hand-built dataset
Key Topics to Cover
CTEs
DISTINCT vs join fan-out
NULL handling
Aggregation
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you return the top folders per business unit instead of overall?
  • How would you include folders with zero exposed files in a full report?
  • Share events arrive late and out of order; how would you compute exposure as of a given date?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

files(file_id, folder_path, owner), one row per file. classifications(file_id, label, confidence), possibly many rows per file. shares(file_id, share_type, created_at, revoked_at), many rows per...

Approach

Build two sets of file ids first: sensitive files and currently publicly linked files, each with DISTINCT. Joining those to files gives at most one row per file, so COUNT(*) is safe. Joining the...


Submit Your Answer
Markdown supported

Related Questions