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

วิธีทำความเข้าใจ SQL เข้าร่วมกับ AI Quiz

ฝึกฝนผลลัพธ์การรวมภายในและภายนอก การคูณแถวหลายต่อหลายแถว และการวางตัวกรองโดยใช้ลูกค้ารายย่อยและตัวอย่างคำสั่งซื้อ

เส้นทางแนะนำที่เกี่ยวข้องทำความเข้าใจ Sql เข้าร่วมกับ AI
คำถาม 1 ของ 8

เอด้ามีสองคำสั่ง และเบ็นไม่มี มีกี่แถวที่เป็นผลมาจากการรวมที่ลูกค้าต่อการสั่งซื้อของคำแนะนำก่อนที่จะกรองเพิ่มเติม

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

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

  1. เอด้ามีสองคำสั่ง และเบ็นไม่มี มีกี่แถวที่เป็นผลมาจากการรวมที่ลูกค้าต่อการสั่งซื้อของคำแนะนำก่อนที่จะกรองเพิ่มเติม
    • สอง เนื่องจากนับเฉพาะคำสั่งซื้อเท่านั้น
    • ประการแรก เนื่องจากชื่อลูกค้ามีเอกลักษณ์เฉพาะตัว
    • สาม รวมทั้งแถวที่ไม่ตรงกันของเบ็นด้วย
    • สี่ เพราะลูกค้าทุกคนจะได้สองแถว
  2. บรรทัดใบสั่งสามรายการและเรกคอร์ดส่งเสริมการขายสองรายการใช้คีย์ผลิตภัณฑ์ร่วมกัน ชุดค่าผสมที่ตรงกันจำนวนเท่าใดที่รวมความเท่าเทียมกันกับคีย์นั้น
    • หก
    • ห้า
    • สาม
    • สอง
  3. รายงานควรมีหนึ่งแถวต่อลูกค้าหนึ่งราย แต่ขณะนี้การรวมจะส่งคืนหนึ่งแถวต่อคำสั่งซื้อ สิ่งที่ควรชี้แจงก่อนที่จะยอมรับคำถาม?
    • การเรียงลำดับผลลัพธ์ตามลูกค้าจะลบแถวคำสั่งซื้อพิเศษออกหรือไม่
    • ไม่ว่าการเลือกคอลัมน์ลำดับน้อยลงเพียงอย่างเดียวจะเปลี่ยนเกรนเอาท์พุตหรือไม่
    • การเปลี่ยนชื่อคีย์ลูกค้าจะทำให้คีย์ไม่ซ้ำกันในผลลัพธ์ที่รวมหรือไม่
    • เกรนผลลัพธ์ที่ต้องการและวิธีรวบรวมข้อมูลคำสั่งซื้อ
  4. การรวมด้านซ้ายควรเก็บลูกค้าไว้โดยไม่มีคำสั่งซื้อที่จัดส่ง เงื่อนไขที่จำกัดการจับคู่คำสั่งซื้อที่จัดส่งอาจอยู่ที่ไหน
    • In a WHERE condition that rejects all null right-side values
    • In the ON condition that controls which orders match
    • Only in the final ORDER BY clause
    • In a DISTINCT operation after all orders have been joined
  5. Why is adding DISTINCT not a reliable general fix for inflated totals after a many-to-many join?
    • DISTINCT establishes one row per customer regardless of which columns are selected
    • DISTINCT makes each join-key value unique before matching occurs
    • It may hide duplicate-looking results without correcting the matching or aggregation logic
    • DISTINCT guarantees that an aggregate computed after the join used each source amount once
  6. Which join preserves unmatched rows from both input tables?
    • A full outer join
    • An inner join
    • A left join in every table order
    • A self join regardless of its join type
  7. After a left join, why can COUNT(*) differ from COUNT of a non-null right-side identifier?
    • COUNT(*) counts only distinct customers
    • COUNT of the identifier includes every null-extended row
    • COUNT(*) automatically removes duplicate join keys
    • COUNT(*) includes unmatched output rows while the identifier count excludes their nulls
  8. An AI explanation assumes ordinary equality will match two null join-key values. How should that claim be treated?
    • Accept it because both sides contain the same missing-value marker
    • Correct it using the database's null semantics
    • Accept it because an outer join changes equality comparisons involving null
    • Assume two null keys match whenever both source columns have the same data type