FOUNDATIONS-1: Tables, Rows & Spotting Duplicate Primary Keys
Track: Analytics Foundations • Difficulty: Beginner • Mastery Points: 100 PTS
Business Problem Scenario
Welcome to your first analytics lab! Imagine a spreadsheet of customers where each person is supposed to appear exactly once. Yesterday, an app bug saved the same customer twice. If a manager counts rows in this table, they will double-count customers and report inflated signups.
Engineering Objective
Find all duplicate customer_id records in bronze.customers_raw. • Expected Columns: customer_id, row_count • Logic: - Group rows by customer_id. - Keep only groups with more than 1 row. - Order by row_count DESC, customer_id ASC.
Target Table: bronze.customers_raw (customer_id TEXT [intended key, unenforced in bronze], full_name TEXT, email TEXT, signup_date DATE)
Verification & Architecture Insights
A Primary Key uniquely identifies each row in a table. Checking `GROUP BY key HAVING COUNT(*) > 1` is the universal first step data analysts run to verify uniqueness before trusting any metric.