Note that LEFT JOIN and LEFT OUTER JOIN are same, the OUTER keyword is optional.
CREATE TABLE customers (
customer_id INT,
customer_name VARCHAR(50),
city VARCHAR(50)
);
CREATE TABLE orders (
order_id INT,
customer_id INT,
order_date DATE,
order_total DECIMAL(10, 2)
);
INSERT INTO customers (customer_id, customer_name, city)
VALUES (1, 'John Doe', 'New York'),
(2, 'Jane Smith', 'Los Angeles'),
(3, 'Michael Johnson', 'Chicago'),
(4, 'Emily Davis', 'San Francisco');
(5, 'karan', 'Chicago');
(8, 'David', 'Los Angeles');
INSERT INTO orders (order_id, customer_id, order_date, order_total)
VALUES (1, 1, '2023-05-15', 500.50),
(2, 2, '2023-06-01', 800.20),
(3, 1, '2023-06-10', 1200.75),
(4, 3, '2023-06-05', 1000.40),
(5, 4, '2023-05-20', 900.90),
(6, 3, '2023-06-15', 1500.60),
(7, 2, '2023-06-12', 700.30);
✅ To learn more, visit us at https://visionforanalytics.com/
✅ Join our WhatsApp group to ask any questions you may have!https://chat.whatsapp.com/LTLprgdpVIh...
✅ Subscribe to the YouTube channel here:👇
/ @sqlcoder