SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
--CREATE DATABASE OnlineShopping; --USE OnlineShopping; CREATE TABLE tbl_ProductChopee( chopee_ID INT IDENTITY(1,1) PRIMARY KEY, chopee_Name VARCHAR(50), chopee_Price DECIMAL(12,4), chopee_Quantity INT, chopee_Sales DATE ); INSERT INTO tbl_ProductChopee(chopee_Name, chopee_Price, chopee_Quantity, chopee_Sales) VALUES ('Invisible Cloak', 999.99, 50, '2023-01-31'), ('Single-Use Infinite Battery', 49.99, 75, '2023-07-04'), ('Anti-Gravity Hat', 299.99, 30, '2023-08-10'), ('Self-Watering Watering Can', 14.99, 150, '2023-10-31'), ('Pet Rock', 9.99, 80, '2023-12-25'), ('Noise-Canceling Alarm Clock', 59.99, 25, '2024-01-01'), ('Instant Ice Cream Heater', 39.99, 40, '2024-04-01'), ('Portable Black Hole', 499.99, 10, '2024-05-12'); CREATE TABLE tbl_ProductLabada( labada_ID INT IDENTITY(1,1) PRIMARY KEY, labada_Name VARCHAR(50), labada_Price DECIMAL(12,4), labada_Quantity INT, labada_Sales DATE ); INSERT INTO tbl_ProductLabada(labada_Name, labada_Price, labada_Quantity, labada_Sales) VALUES ('Portable Black Hole', 499.99, 10, '2024-05-12'), ('Inflatable Dartboard', 34.99, 80, '2024-07-07'), ('Square Watermelon Molder', 9.99, 150, '2024-09-03'), ('Self-Charging Solar Flashlight', 29.99, 100, '2024-12-25'), ('Edible Cutlery Set', 19.99, 120, '2025-02-14'), ('Automatic Banana Peeler', 39.99, 50, '2025-04-01'), ('Voice-Controlled Silence Generator', 79.99, 30, '2025-10-31'), ('Pet Rock', 9.99, 80, '2023-12-25'); --[JOIN ON] SELECT chopee_Name, chopee_Price,labada_Name,labada_Price from tbl_ProductChopee JOIN tbl_ProductLabada on chopee_ID = labada_ID; --[OUTER JOIN -> LEFT JOIN] SELECT chopee_Name, chopee_Price,labada_Name,labada_Price from tbl_ProductChopee LEFT JOIN tbl_ProductLabada on chopee_ID = labada_ID; --{OUTER JOIN -> RIGHT JOIN] SELECT chopee_Name, chopee_Price,labada_Name,labada_Price from tbl_ProductChopee RIGHT JOIN tbl_ProductLabada on chopee_ID = labada_ID;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear