แบบทดสอบที่เชื่อมโยงกับคำแนะนำ · ปานกลาง ระดับ

วิธีแก้ไขข้อผิดพลาด SQL ด้วยแบบทดสอบ AI

ฝึกฝนการวินิจฉัยข้อผิดพลาด SQL จัดกลุ่มการซ่อมแซมและการตรวจสอบผลลัพธ์โดยใช้คอลัมน์ที่ไม่ชัดเจน สคีมาที่เปลี่ยนแปลง และฟิกซ์เจอร์ทดสอบขนาดเล็ก

เส้นทางแนะนำที่เกี่ยวข้องแก้ไขข้อผิดพลาด Sql ด้วย AI
คำถาม 1 ของ 8

Two joined tables both contain id, and the intended output is the customer's identifier. Which repair addresses the ambiguity?

ดูตัวอย่างทุกคำถาม8 คำถาม

คำตอบและคำอธิบายจะปรากฏขึ้นเมื่อคุณทำแบบทดสอบ

  1. Two joined tables both contain id, and the intended output is the customer's identifier. Which repair addresses the ambiguity?
    • Qualify id with the customer table's alias
    • Choose either id because matching names imply identical values
    • Add every column to GROUP BY
    • Rename the output heading without qualifying the reference
  2. Why can adding every selected column to GROUP BY be a poor repair for a customer-total report?
    • It guarantees that all selected dates belong to the same customer summary
    • It preserves customer-level totals regardless of the added columns
    • It may change the result from one row per customer to a finer grouping
    • It automatically chooses the latest order date within each customer
  3. An error points near the end of an expression. Why should earlier tokens also be inspected?
    • The marked token must always be the first incorrect token
    • Only the final clause can affect parsing near the end
    • Name-resolution errors can always be fixed by moving the marked token
    • An earlier missing comma or unmatched parenthesis can make a later token unexpected
  4. Which information is most useful when asking AI to reproduce an SQL failure?
    • The query and a paraphrase of the error, without identifying the engine
    • The engine, exact error, query, minimal schema and representative test rows
    • Only a successful version from another database engine
    • Only the expected output, without the query or schema
  5. A repaired SQL statement executes successfully. Which check still matters?
    • Whether its rows, totals and null behavior match the intended result
    • Whether it returns the same row count, without checking values
    • Whether it has the same output headings, without checking totals
    • Whether it runs once without an error on an empty fixture
  6. การแปลงข้อมูลสำเร็จสำหรับหลายแถวแต่ล้มเหลวสำหรับค่าข้อความที่ไม่คาดคิดหนึ่งค่า ขั้นตอนดีบักใดที่มุ่งเน้นความล้มเหลวนั้น?
    • ลบข้อมูลประเภทออกจากคำสั่ง
    • สมมติว่าคำสั่งมีไวยากรณ์ไม่ถูกต้องในทุกบริบท
    • รวมค่าที่ล้มเหลวในชุดทดสอบที่ลดขนาดลง
    • เพิ่มการเชื่อมต่อที่ไม่เกี่ยวข้องเพื่อเปลี่ยนแผนการดำเนินการ
  7. ทำไม PostgreSQL EXPLAIN ANALYZE จึงไม่เหมาะสมเป็นการตรวจสอบไวยากรณ์ที่ปลอดภัยสำหรับคำสั่งที่เปลี่ยนแปลงโดยไม่เชื่อถือได้?
    • มันไม่เคยรายงานพฤติกรรมการดำเนินการจริง
    • มันเพียงตรวจสอบชื่อย่อของตาราง
    • มันมักข้ามการดำเนินการเขียนของคำสั่ง
    • มันทำการดำเนินการจริง
  8. คำสั่งของแอปพลิเคชันใช้พารามิเตอร์ที่ผูกไว้ ทำไมต้องรักษาประเภทของพวกเขาในการสร้างตัวอย่าง?
    • ประเภทพารามิเตอร์ไม่สามารถส่งผลกระทบต่อการดำเนินการฐานข้อมูล
    • ค่าลิตเทอเรลที่แทนที่อาจมีพฤติกรรมแตกต่างจากค่าที่ผูกไว้เดิม
    • ทุกพารามิเตอร์ควรแปลงเป็นข้อความก่อนทดสอบ
    • พารามิเตอร์ที่ผูกไว้ทำให้ไม่จำเป็นต้องตรวจสอบการแปลงประเภท