SQL Data Quality Check Queries for a New Dataset
Write checks for duplicates, nulls and impossible values.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
[VERIFY] is an editorial flag, not a blank to fill. Wherever the prompt shows [VERIFY], check that item against a reliable source before you use it.
Write SQL data quality checks. Table names, columns, types and what each column should contain: [TABLE_DESCRIPTION]. Keys that should be unique: [UNIQUE_KEYS]. Valid ranges and allowed values: [VALID_VALUES]. Database system: [DATABASE]. Write queries that count and list: duplicate keys, nulls in required columns, values outside ranges, invalid categories, dates in the future or before the system existed, orphaned foreign keys, inconsistent text (case and spacing), and rows where related columns disagree (end before start). Explain in a sentence a business user could read what a non-zero result means and what to do next. Combine the counts into a summary query returning one row per check with failing rows and the percentage of total rows; example (invented): 12 duplicate keys among 4,800 rows is 0.25 percent. Run on a copy or read-only access, avoid selecting personal data into reports, and set a schedule for running the checks. Mark syntax that may differ [VERIFY].
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.