Diagnose SQL Query Error
When you encounter an error in your SQL query and need a quick diagnosis and solution.
Prompt
I ran this SQL query: [QUERY]. I got error: [ERROR_MESSAGE]. My database is [DATABASE_TYPE]. Explain what caused the error and provide the corrected query. If there are multiple possible issues, list them and suggest fixes for each.
Fill in these
Swap each placeholder for your own value:
[QUERY][ERROR_MESSAGE][DATABASE_TYPE]
Pro tips
- Include the table schemas to help detect column name typos or type mismatches.
- Ask for common pitfalls related to your SQL dialect.
- Request a version with inline comments explaining each correction.
Related prompts
Complex Conditional Formula Generator
Act as a spreadsheet expert. I need a formula for [SPREADSHEET_APP] to calculate [DESIRED_OUTCOME] based on these conditions: [CONDITIONS]. The formula should handle [DATA_RANGE_REFERENCE] and include [SPECIFIC_FUNCTIONS, e.g., IF, VLOOKUP, INDEX-MATCH]. Use best practices for readability and error handling. Output only the formula with a brief explanation of how it works.
View promptClean Messy Text Columns with Formulas
I have a spreadsheet column containing [DATA_TYPE, e.g., full names, addresses, email addresses] that is inconsistently formatted. Common issues include [LIST_ISSUES, e.g., extra spaces, mixed case, inconsistent separators]. Please provide a set of formulas or functions in [SPREADSHEET_APP] to clean this column, transforming the data into a consistent format: [DESIRED_FORMAT]. Include explanations for each formula step. If a single formula is too complex, break it down into helper columns.
View promptConvert Natural Language to SQL Query
You are a SQL expert. I will provide a description of my database tables and a question. Write a SQL query to answer the question. Use clear aliases, comments, and optimize for readability. Tables: [TABLE_SCHEMAS]. Question: [QUESTION]. Include only the SQL code in your response, with a brief explanation after.
View promptExplain Data Trend or Anomaly
I have a dataset about [DATASET_DESCRIPTION]. I observed a [TREND_OR_ANOMALY] between [TIME_PERIOD_OR_SEGMENT]. My hypothesis is [YOUR_HYPOTHESIS, if any]. Help me interpret this finding. Consider factors such as [RELEVANT_FACTORS]. Provide possible explanations, suggest additional data to analyze, and ask me clarifying questions to narrow down causes.
View prompt