The Prompt Library
CodingSQL

Translate Business Question into SQL

Turn a plain-language question into an executable SQL query.

Select Model:

Prompt:

Please translate the following business question into a SQL query that can retrieve the necessary information from our database. BUSINESS QUESTION: [BUSINESS_QUESTION] DATABASE DETAILS: - Database system: [DATABASE_SYSTEM] - Query objective: [QUERY_OBJECTIVE] SCHEMA INFORMATION: - Tables and columns: * [TABLE_NAME_1]: [COLUMNS_1] * [TABLE_NAME_2]: [COLUMNS_2] * [Additional tables as needed] - Table relationships: * [RELATIONSHIP_1] * [RELATIONSHIP_2] * [Additional relationships as needed] - Data considerations: * [DATA_CONSIDERATION_1] * [DATA_CONSIDERATION_2] * [Additional considerations as needed] - Business rules: * [RULE_1] * [RULE_2] * [Additional rules as needed] Please provide: 1. A complete SQL query that addresses the business question 2. Explanation of the query logic and structure 3. Any assumptions made in creating the query 4. Performance considerations 5. Possible variations or alternative approaches Ensure the SQL follows best practices and is optimized for the specified database system.

Related Prompts

Other prompts you might find useful

CodingSQL

Write a SQL Query

Generate a SELECT query with filters, joins, and sorting.

6 models availableView details
CodingSQL

Explain a SQL Query

Break down what a SQL query does, step-by-step.

6 models availableView details
CodingSQL

Create a Table Schema

Define a SQL table schema with columns, types, and constraints.

6 models availableView details
CodingSQL

Optimize a SQL Query

Refactor a SQL query for performance, indexing, or simplicity.

6 models availableView details