Skip to content · ⁨Saltar al contenido⁩
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.

Español

Unir dos tablas

Para utilizar datos de ambas tablas a la vez, las uniós. Un INNER JOIN empareja filas que coinciden en una clave —en este caso, el customer_id del pedido con el id del cliente:

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

Cuando un nombre de columna podría pertenecer a cualquiera de las dos tablas, escribe table.column para que quede claro.

Handout · ⁨Material⁩

Log in or create account · ⁨Iniciar sesión o crear cuenta⁩

IGCSE, A-Level & AP