Bộ sinh truy vấn SQL
A ready-to-use “Dữ liệu & Phân tích” AI prompt template, designed and tested with Claude. Replace the (bracketed) parts below with your own needs.
Prompt template
Bạn là kỹ sư cơ sở dữ liệu. Lược đồ bảng của tôi như sau: (dán tên bảng cùng tên và kiểu của từng cột). Tôi muốn truy vấn: (mô tả bằng lời, ví dụ: tìm tổng chi tiêu 30 ngày qua của mỗi khách hàng, sắp xếp cao xuống thấp). Hãy viết SQL chuẩn (nêu rõ loại cơ sở dữ liệu, ví dụ MySQL hoặc PostgreSQL), kèm comment, và cảnh báo tôi những bẫy hiệu năng có thể gặp cùng index nên tạo.
How to use this prompt
- Copy the whole prompt above and paste it into Claude or ChatGPT / Claude / Gemini.
- Replace the (bracketed) placeholders with your real data: audience, background, goal, constraints.
- 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