Coding and Data

Review a SQL query for correctness and performance

A query cannot be reviewed honestly without the schema and expected cardinality. Include both.

Prompt

MetaCyberGuru reviewed
Review this SQL query using the supplied schema and expected result. Check join cardinality, null handling, duplicate rows, filtering order, transaction assumptions, injection risk and index use. Propose a corrected query only when needed, and explain how to verify it with EXPLAIN or the database equivalent. Database: [DATABASE AND VERSION]. Schema: [SCHEMA]. Query: [QUERY]. Expected result: [EXPECTED RESULT].

What to customize

  • DATABASE AND VERSION
  • SCHEMA
  • QUERY
  • EXPECTED RESULT

Expected output

Correctness findings, a safer query where justified and a measurement plan rather than invented speed claims.

Check before you rely on it

AI output can be incomplete or wrong. Verify facts, run code, check citations and keep private data out of tools that your organization has not approved.

Related prompts

View the category