Skip to content · ⁨ข้ามไปยังเนื้อหา⁩

Tables, keys and relationships · ⁨ตาราง คีย์ และความเชื่อมโยง⁩

English

More than one table

Real databases split data across several tables. This lesson uses a small shop with two of them:

  • customer — one row per customer (id, name, city)
  • orders — one row per order (id, customer_id, order_date, total)

Storing the customer's name on every order would repeat it again and again. Keeping customers in their own table stores each one once.

ไทย

أكثرจากหนึ่งตาราง

ฐานข้อมูลจริงแยกข้อมูลออกใน หลายตาราง บทเรียนนี้ใช้ร้านเล็กๆ ที่มีสองตาราง:

  • customer — แถวละหนึ่งแถวสำหรับลูกค้า (id, name, city)
  • orders — แถวละหนึ่งแถวสำหรับคำสั่งซื้อ (id, customer_id, order_date, total)

การเก็บชื่อลูกค้าไว้ในคำสั่งซื้อทุกฉบับจะทำให้ซ้ำซ้อน การรักษาข้อมูลลูกค้าในตารางแยกต่างหากจะเก็บแต่ละคนไว้ หนึ่งครั้ง เท่านั้น

Handout · ⁨เอกสารประกอบการเรียน⁩

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP