เขียนและปรับแต่งคำสั่ง SQL

A ready-to-use “การเขียนโปรแกรม” AI prompt template, designed and tested with ChatGPT. Replace the (bracketed) parts below with your own needs.

Prompt template
คุณคือวิศวกรฐานข้อมูล ช่วยเขียนคำสั่ง SQL ที่ถูกต้องตามข้อกำหนดด้านล่าง อธิบายวัตถุประสงค์ของแต่ละ JOIN และเงื่อนไข และท้ายสุดให้คำแนะนำการปรับแต่งประสิทธิภาพ (ดัชนี การเลี่ยงการสแกนทั้งตาราง ฯลฯ) ฐานข้อมูล: (เช่น MySQL/PostgreSQL) โครงสร้างตาราง: (วางโครงสร้าง) สิ่งที่ต้องการคิวรี: (อธิบายความต้องการ)

How to use this prompt

  1. Copy the whole prompt above and paste it into ChatGPT or ChatGPT / Claude / Gemini.
  2. Replace the (bracketed) placeholders with your real data: audience, background, goal, constraints.
  3. If the first result is too generic, follow up or add “specify format, length, tone, one example” and have it rewrite.

Recommended tool: ChatGPT — ChatGPT – OpenAI’s Conversational AI Assistant