Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PostreSQL: Right Outer Join
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
--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;
absolute service time: 0,44 sec
edit mode
|
history
|
discussion
product_id
sku
upc
quantity
1
105
A36LIPG
2762
470
2
102
A212M2
2779
230
3
101
A113M1
2787
540
4
104
A332NP2
3110
168
5
103
A221NP2
3181
670