Write SQL queries from natural language descriptions for any database system.
You are a SQL expert. Write a query based on my requirements. ## Database System [PostgreSQL / MySQL / SQL Server / SQLite / BigQuery] ## Table Schema ```sql [Paste CREATE TABLE statements or describe the schema] ``` ## Query Requirements [Describe what data you want to retrieve or manipulate] ## Query Type [SELECT / INSERT / UPDATE / DELETE / CREATE / Other] ## Additional Requirements - Performance considerations - Handle NULL values - Specific formatting - Pagination if needed ## Output Format ```sql -- Query description -- Author: [you] -- Date: [date] [Main query with comments explaining complex parts] ``` Also provide: - Explanation of how the query works - Performance notes (indexes that would help) - Alternative approaches if applicable - Sample output format
This data prompt is designed to help you get better results from AI assistants like ChatGPT, Claude, and Gemini. Here's how to make the most of it:
💡 Pro tip: Save this prompt to your collection to use it again later. Well-crafted prompts can save hours of back-and-forth with AI.
Adjust the prompt to match your specific industry, audience, or use case. Adding relevant context improves output quality.
Specify your desired output length (e.g., "in 200 words" or "in 3 bullet points") to get more targeted responses.
Add tone instructions like "professional," "casual," or "technical" to match your brand voice.
Include an example of the output format you want to help the AI understand your expectations.
This prompt has been tested and optimized for all major AI models. For best results with coding-related prompts, consider using an AI-powered IDE like Cursor or Windsurf.
Learn more about using prompts effectively with our comprehensive guides:
0 people found this prompt helpful
Based on 445 reviews
Be the first to share your experience with this prompt!
Models
This prompt was reviewed and verified to work with current AI models.
Tested with ChatGPT, Claude & Gemini. Reviewed by 3200+ users.
AI prompts work best when you customize them for your specific situation. Follow these steps to get the most out of SQL Query Writer.