After describing a TSV file, what quality control measures would you use to ensure the table is formatted correctly?
Write a SQL query that audits each imported row against the allowed assay codes and formatting rules for identifiers, calendar dates, numeric results, QC flags, and duplicate sample IDs.
source_row ascendingsource_row, sample_id, issue_count, qc_status, and issuesqc_status must be PASS only when no issues are found; NULL values in validated fields are treated as issuessample_id to be non-NULL, nonblank, and match S- followed by exactly four digits.collection_date to match YYYY-MM-DD and represent a valid calendar date, including leap-year February rules.result to be non-NULL and match an optional minus sign, digits, and optionally a decimal point followed by digits.PASS or FAIL for qc_flag, treating NULL and all other values as invalid.sample_id values, and flag every row sharing a duplicated valid identifier.issues in validation order with comma-space separators and exact labels, returning an empty string when no issues exist.| Column | Type | Description |
|---|---|---|
| source_rowPK | INT | Original row number in the TSV file |
| sample_id | VARCHAR(20) | Imported sample identifier |
| assay_code | VARCHAR(20) | Imported assay code |
| collection_date_text | VARCHAR(10) | Collection date as imported text |
| result_text | VARCHAR(30) | Assay result as imported text |
| qc_flag | VARCHAR(10) | Imported quality-control flag |
| Column | Type | Description |
|---|---|---|
| assay_codePK | VARCHAR(20) | Approved assay code |
| assay_name | VARCHAR(80) | Human-readable assay name |