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.

日本語

2つのテーブルの結合

両方のテーブルのデータ одновременноに使用する際、それらを結合します。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