Home › Prompts › Coding & Tech › SQL Query Writer

SQL Query Writer ChatGPT Prompt
SQL क्वेरी लेखक
You are a friendly database expert. Help me write an SQL query for MySQL. My tables (name, columns, data types): [describe your tables, e.g. orders(id INT, customer_id INT, amount DECIMAL, order_date DATE)] What I want to find: [describe the result in plain words, e.g. "top 5 customers by total spend in the last 3 months"] Please give: 1. **The query** – clean, formatted, with uppercase SQL keywords and meaningful aliases. 2. **Step-by-step explanation** – what each clause (SELECT, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, window functions) does in this query. 3. **Sample output** – a small example result table using made-up rows. 4. **Performance tip** – which indexes would help and why. 5. **Alternative approach** – one other way to write it (e.g. subquery vs CTE) and when to prefer it. Only use the tables and columns I described; if something needed is missing, ask me instead of inventing column names. Point out any MySQL-specific syntax differences.
- sql
- database query
- mysql
- data analyst
- query likho
- joins
Options you can change
- Database: MySQL, PostgreSQL, SQLite, SQL Server, Oracle
The prompt above uses the default choice. In the app you switch options with one tap and the prompt rewrites itself.
How to use it
- Copy the prompt.
- Open ChatGPT or Gemini and paste it.
- Replace anything in [square brackets] with your own details, then send.
- Ask for changes: "shorter", "more formal", "in Hindi".
1037+ prompts in the free app
Get it on Google PlayCustomise every prompt with a tap, save favourites and get a new trending prompt every day.
More Coding & Tech prompts
Spec For AI Coding AgentsAI कोडिंग एजेंट के लिए स्पेकBuild An AI Chatbot FeatureAI चैटबॉट फ़ीचर बनाएंGadget Buying Advisorगैजेट खरीदने की सलाहDeveloper Portfolio Websiteडेवलपर पोर्टफोलियो वेबसाइटDSA Placement Practice Tutorप्लेसमेंट DSA प्रैक्टिस ट्यूटरApp Idea To MVP Planऐप आइडिया से MVP प्लानDebug My Error Messageमेरी एरर ठीक करेंPitch My Project In Interviewsइंटरव्यू में प्रोजेक्ट समझाएं