Skip to content · ⁨Lompat ke konten⁩
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.

Bahasa Indonesia

Menggabungkan dua tabel

Untuk menggunakan data dari kedua tabel sekaligus, Anda menggabungkan mereka. Sebuah INNER JOIN memasangkan baris yang cocok pada kunci — di sini, customer_id pesanan dengan id pelanggan:

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

Ketika nama kolom bisa berasal dari kedua tabel, tuliskan table.column agar jelas.

Handout · ⁨Lembar Kerja⁩

Log in or create account · ⁨Masuk atau buat akun⁩

IGCSE, A-Level & AP