Convert Natural Language to SQL Query
When you need to quickly generate an SQL query from a business question and you have the table schemas.
Prompt
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.
Fill in these
Swap each placeholder for your own value:
[TABLE_SCHEMAS][QUESTION]
Pro tips
- Specify the SQL dialect (e.g., PostgreSQL, MySQL) if relevant.
- If the question is vague, ask for clarification or provide alternative queries.
- Request the output to include common table expressions for complex queries.
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 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 promptRecommend Best Chart Type for Data Story
I want to visualize [DATA_MEASUREMENTS] to communicate [STORY_OR_INSIGHT] to an audience of [AUDIENCE_TYPE]. The data includes [VARIABLES, e.g., time, categories, numeric values]. Suggest the most effective chart type(s) in [TOOL_NAME] and explain why. Include tips on chart design such as color, labeling, and avoiding common pitfalls. If a combination chart is better, describe how to set it up.
View prompt