Write optimized SQL queries for the following requirement:
Database: [DATABASE TYPE]
Schema: [DESCRIBE TABLES AND RELATIONSHIPS]
Requirement: [WHAT DATA DO YOU NEED]
For each query provide:
1. The complete SQL query with proper formatting
2. Explanation of the approach
3. Index recommendations (CREATE INDEX statements)
4. Performance notes
5. Alternative approach if the dataset exceeds 10M rows
Also flag potential issues with: NULL handling, timezone conversions, data type mismatches.
Write optimized SQL queries for the following requirement:
Database: [DATABASE TYPE]
Schema: [DESCRIBE TABLES AND RELATIONSHIPS]
Requirement: [WHAT DATA DO YOU NEED]
For each query provide:
1. The complete SQL query with proper formatting
2. Explanation of the approach
3. Index recommendations (CREATE INDEX statements)
4. Performance notes
5. Alternative approach if the dataset exceeds 10M rows
Also flag potential issues with: NULL handling, timezone conversions, data type mismatches.
How to use this prompt
Copy the prompt above and paste it into ChatGPT, Claude, Gemini, or any AI assistant. Replace the bracketed placeholders with your specific details.
Leave a Review
Tried this prompt? Let us know how it worked — your reviews help other users find the best prompts.