MySQL: JOINS are easy (INNER, LEFT, RIGHT)

Your video will begin in 10
67 Views
Published
#MySQL #course #tutorial

00:00:00 intro
00:01:46 INNER JOIN
00:03:48 LEFT JOIN
00:04:20 RIGHT JOIN
00:04:45 conclusion

-- INNER JOIN selects records that have a matching key in both tables.
SELECT *
FROM transactions INNER JOIN customers
ON transactions.customer_id = customers.customer_id;

-- LEFT JOIN returns all records from the left table
-- and the matching records from the right table
SELECT *
FROM transactions LEFT JOIN customers
ON transactions.customer_id = customers.customer_id;

-- RIGHT JOIN returns all records from the right table
-- and the matching records from the left table
SELECT *
FROM transactions RIGHT JOIN customers
ON transactions.customer_id = customers.customer_id;
Category
Bro Code
Tags
MySQL tutorial for beginners, SQL tutorial for beginners, MySQL course
Be the first to comment