Junior — Middle
Explain what the INNER JOIN operation means in the context of table joins in SQL
sobes.tech AI
Answer from AI
The INNER JOIN operation in SQL is used to combine rows from two tables based on a matching condition in specified columns.
The result of an INNER JOIN will only include rows where a match is found in both tables.
For example, if there is an orders table and a customers table, then an INNER JOIN on the customer_id field will return only orders that have a corresponding customer.
Example query:
SELECT orders.id, customers.name
FROM orders
INNER JOIN customers ON orders.customer_id = customers.id;
In this case, only orders linked to existing customers will be selected.