Bài kiểm tra có liên kết hướng dẫn · Trung bình Cấp độ

Cách viết truy vấn SQL bằng AI Quiz

Kiểm tra xem bạn có thể cung cấp cho AI lược đồ của mình tốt đến mức nào, nắm bắt các bẫy phân xuất tham gia và bẫy NULL, đồng thời xác minh một cách an toàn SQL do AI tạo ra trước khi tin cậy vào kết quả.

Đường dẫn hướng dẫn liên quanCách viết truy vấn Sql bằng AI
Câu hỏi 1 của 8

Theo hướng dẫn, bước đơn lẻ nào giúp cải thiện độ chính xác của SQL do AI tạo ra nhiều nhất?

Xem trước mọi câu hỏi8 câu hỏi

Câu trả lời và giải thích xuất hiện khi bạn làm bài kiểm tra.

  1. Theo hướng dẫn, bước đơn lẻ nào giúp cải thiện độ chính xác của SQL do AI tạo ra nhiều nhất?
    • Asking the model to be extra careful
    • Pasting your schema, such as CREATE TABLE statements and relationships
    • Writing your question entirely in uppercase
    • Always using the newest model available
  2. Tại sao bạn nên cho AI biết bạn đang sử dụng phương ngữ SQL nào?
    • Only PostgreSQL supports SELECT statements
    • AI models refuse to answer without a dialect
    • The dialect determines how much disk space a query uses
    • Dialects differ in details like date functions and LIMIT versus TOP
  3. Bạn nối các đơn hàng với order_items rồi tính SUM(orders.total). Vấn đề có thể xảy ra là gì?
    • Revenue is inflated because each order total repeats once per item
    • The query will always fail with a syntax error
    • NULL values are converted to zero
    • The results come back sorted in the wrong order
  4. Tại sao hướng dẫn viên lại khuyên bạn nên yêu cầu AI giải thích truy vấn của mình bằng những từ ngữ đơn giản?
    • It makes the query run faster
    • SQL engines require an explanation before executing
    • It exposes misunderstandings, such as counting rows instead of distinct customers
    • It reduces the cost of the AI request
  5. Câu nào về COUNT(cột) và COUNT(*) là đúng?
    • They always return the same number
    • COUNT(column) skips NULLs, while COUNT(*) counts every row
    • COUNT(*) skips NULLs, while COUNT(column) counts every row
    • COUNT(column) counts only distinct values
  6. What is the safest way to experiment with AI-generated queries?
    • Run them directly on production during quiet hours
    • Ask the AI whether the query is safe and trust the answer
    • Use a read-only database user and wrap data changes in a transaction you can roll back
    • Remove the WHERE clause so the query is simpler
  7. When asking an AI to optimize a slow query, what should you provide besides the query?
    • A screenshot of the dashboard that uses it
    • The database password
    • A list of everyone who runs the report
    • The execution plan from EXPLAIN or EXPLAIN ANALYZE
  8. Which of these is a misconception the guide warns against?
    • A query that runs without errors must be returning the right answer
    • The schema alone is often enough context, without real customer data
    • An UPDATE without a WHERE clause affects every row
    • Business rules like amounts stored in cents should be stated