Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PostreSQL: Right 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) ); 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); CREATE TABLE warehouse( sku CHAR(50) PRIMARY KEY NOT NULL, upc INT NOT NULL, quantity INT NOT NULL ); 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); SELECT product.product_id, product.sku, warehouse.upc, warehouse.quantity FROM product RIGHT OUTER JOIN warehouse ON product.sku= warehouse.sku ORDER BY warehouse.upc;
run
|
edit
|
history
|
help
0
loggin_trigger-audit
Yy
Assignment
PostgreSQL pivot using temp view
Funciones matemáticas PostgreSQL
distinct on vs row_number
Pedido
Codigo_Completo
PostgresInsertIfNotExists
2