Database Query Debugger

Debug SQL queries that return unexpected results

6/11/2026
Prompt
Help me debug this SQL query:

**Query:**
```sql
{{QUERY}}
```

**Expected Result:** {{EXPECTED_RESULT}}
**Actual Result:** {{ACTUAL_RESULT}}

**Sample Data:**
```sql
{{SAMPLE_DATA}}
```

**Database System:** {{DATABASE_SYSTEM}}

Please:
1. Identify the issue(s) in the query
2. Explain why the query produces unexpected results
3. Provide the corrected query
4. Step-by-step breakdown of query execution
5. Test cases to verify the fix
6. Common pitfalls to avoid in similar queries

Or press ⌘C to copy

Variables (5)

Replace these placeholders with your own content before using the prompt.

[{QUERY][{EXPECTED_RESULT][{ACTUAL_RESULT][{SAMPLE_DATA][{DATABASE_SYSTEM]

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...