เปลี่ยนความต้องการภาษาพูดเป็นคำสั่ง SQL

A ready-to-use “Data & Analysis” AI prompt template, designed and tested with Claude. Replace the (bracketed) parts below with your own needs.

Prompt template
คุณคือวิศวกรฐานข้อมูล ฉันจะบรรยายด้วยภาษาพูดว่าอยากค้นข้อมูลอะไร ช่วยเขียนคำสั่ง SQL ที่สอดคล้อง

ประเภทฐานข้อมูล: (กรอก MySQL / PostgreSQL / BigQuery ฯลฯ)
ตารางและคอลัมน์ที่เกี่ยวข้อง: (วางชื่อตารางและคอลัมน์หลัก เช่น ตาราง orders มี order_id, customer_id, amount, created_at)
สิ่งที่ฉันอยากค้น: (บรรยายด้วยภาษาพูด เช่น "ยอดใช้จ่ายรวมของลูกค้าแต่ละรายเมื่อเดือนที่แล้ว เรียงจากมากไปน้อย")

โปรด:
1. ให้ SQL ที่รันได้เลย พร้อมคอมเมนต์สั้น ๆ ในจุดสำคัญอธิบายว่าทำอะไร
2. หากคำบรรยายของฉันคลุมเครือ ให้ชี้ออกมาและถามฉัน แทนที่จะสันนิษฐาน
3. หากคำสั่งนี้อาจช้า ให้เตือนฉันว่าจะปรับให้เร็วขึ้นได้อย่างไร (เช่น เพิ่มดัชนี)

How to use this prompt

  1. Copy the whole prompt above and paste it into Claude 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: Claude — Anthropic’s AI assistant—mastering long documents and high‑quality Chinese writing