Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PostreSQL: Full Outer Join
--PostgreSQL 9.6 --'\\' is a delimiter --create two tables CREATE TABLE product( product_id INT PRIMARY KEY NOT NULL, sku CHAR(50) NOT NULL, category VARCHAR(50) NOT NULL, date TIMESTAMP, price DECIMAL (10,2) ); CREATE TABLE warehouse( sku CHAR(50) PRIMARY KEY NOT NULL, upc INT NOT NULL, quantity INT NOT NULL ); --insert records into two tables INSERT INTO product (product_id, sku, category,date, price)VALUES (101 , 'A113M1', 'Mascara', '2020-04-23', 23),(102, 'A212M2 ', 'Mascara', '2020-02-12', 23),(103, 'A221NP2', 'Nail Polish', '2020-03-07', 15), (104, 'A332NP2', 'Nail Polish', '2020-05-21', 15),(105 , 'A36LIPG', 'Lipgloss', '2020-07-15', 19); INSERT INTO warehouse (sku, upc, quantity) VALUES ('A113M1', 3445-113-545, 540), ('A212M2', 3445-212-454, 230), ('A221NP2', 3445-221-43, 670), ('A332NP2', 3445-332-003, 168), ('A36LIPG', 3445-336-347, 470); --run query SELECT warehouse.sku, warehouse.upc, product.sku, product.date FROM warehouse FULL OUTER JOIN product ON product.sku= warehouse.sku ORDER BY warehouse.upc
run
|
edit
|
history
|
help
0
Weekly Average Starting on Different Days
Ecommerce Website Analysis by SQL
select distinct
Mandelbrot
1280. Students and Examinations
SQL3
PostreSQL: Left Join
loggin_trigger-audit
librarayv2
SQL Movie-Rating Query Exercises