Data & SQL21 categories
Write data quality checks for this table
Before you trust a table you've just been handed.
Write a set of SQL checks that tell me whether the table below is trustworthy. Cover: 1. **Uniqueness**: is the claimed key actually unique? Are there near-duplicates differing only by whitespace or case? 2. **Completeness**: NULL rate per column, and any column where NULL appears to encode something. 3. **Validity**: values outside plausible ranges, negative amounts, dates in the future or before the system existed, enum columns with unexpected values. 4. **Consistency**: referential integrity against parent tables, totals that should reconcile, mutually exclusive flags both set. 5. **Freshness and volume**: latest row timestamp, rows per day over the last 30 days, and any day with a suspicious gap or spike. Give each check as a runnable query returning the offending rows or a count. Order them by how likely they are to find something. Say which failures would make the table unusable and which are merely noise. Table and schema:
Making it yours
- Paste your own material where the prompt asks for it. Everything above that line is instruction, not content.
- Delete any rule that does not apply to you. A shorter prompt that fits beats a thorough one that does not.
- If the answer comes back vague, add a line saying what you do not want. Constraints work better than encouragement.
Schema and data quality. Designing tables, migrating them without breaking live code, and cleaning what you have been handed.
Related prompts
Review this schema designBefore you create the tables everyone will depend on for years.Write a safe migration for this changeChanging a schema that live code is already reading and writing.Plan the cleanup of a messy columnFree-text data that half-works and needs to become reliable.Choose the shape for this report's dataDeciding between wide, long, or pre-aggregated before you build anything.Explain this query to me line by lineYou inherited a 200-line query and need to understand it before changing it.Make this slow query fasterA query that used to be fine now takes minutes.
Keep this one
Phrasery saves prompts with a right-click and puts them back the same way. Add this to your own library in one click.
Add to your browser โ free