Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Inner 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 and insert records --upc datatype is text not numeric because of the dash --adjust column width using numbers beside the datatype CREATE TABLE product( product_id INT PRIMARY KEY NOT NULL, sku CHAR(10) 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(10) PRIMARY KEY NOT NULL, upc VARCHAR (30) 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-432', 670), ('A332NP2', '3445-332-003', 168), ('A36LIPG', '3445-336-347', 470); --run query Inner Join SELECT product.sku, warehouse.upc, warehouse.quantity FROM product INNER JOIN warehouse ON product.sku= warehouse.sku;
absolute service time: 0,4 sec
edit mode
|
history
|
discussion
sku
upc
quantity
1
A113M1
3445-113-545
540
2
A212M2
3445-212-454
230
3
A221NP2
3445-221-432
670
4
A332NP2
3445-332-003
168
5
A36LIPG
3445-336-347
470