Skip to content · ⁨الانتقال إلى المحتوى⁩
English

Joining two tables

To use data from both tables at once, you join them. An INNER JOIN pairs up rows that match on a key — here, the order's customer_id with the customer's id:

When a column name could come from either table, write table.column so it is clear.

العربية

ربط جدولين

لاستخدام بيانات من كلا الجدولين معًا، تقوم بـ ربطهما. يقوم INNER JOIN بمطابقة الصفوف المتطابقة بناءً على مفتاح — هنا، مفتاح الطلب customer_id مع مفتاح العميل id:

SELECT customer.name, orders.total
FROM customer
INNER JOIN orders ON customer.id = orders.customer_id;

عندما قد يأتي اسم عمود من أي جدول، اكتب table.column ليكون الأمر واضحًا.

Handout · ⁨ورقة عمل⁩

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP