Skip to content
AI Resource Hub

AI prompts for sql

Copy-ready prompts for sql. Replace the [brackets] with your own details for the best results.

SQL

Write a SQL query from plain English

Describe what you need and get a SQL query that matches your schema.

Write a SQL query for [database: PostgreSQL / MySQL / SQL Server / SQLite]. Tables: [paste CREATE TABLE statements or column lists] What I need: [plain-English description, e.g. "top 10 customers by total spend in 2025, with their email and number of orders"] Explain each part of the query, mention any indexes that would help performance, and point out edge cases (e.g. NULLs, ties).

How to use it

Test on a copy of your data. Check that joins don't duplicate rows.

Details

More programming prompts