join
INNER JOIN
Returns one result for each pair satisfying the join predicate. Duplicate matching keys multiply rows; equality does not match NULL to NULL.
Formal Syntax & Structure
sql syntaxsql
a INNER JOIN b ON conditionWorking Example
Example Snippetsql
CREATE TABLE a(id INTEGER PRIMARY KEY, k INTEGER); CREATE TABLE b(bid INTEGER PRIMARY KEY, k INTEGER); INSERT INTO a VALUES (1,10),(2,20),(3,NULL),(4,10); INSERT INTO b VALUES (101,10),(102,10),(103,30),(104,NULL);SELECT a.id,b.bid FROM a INNER JOIN b ON a.k=b.k ORDER BY a.id NULLS LAST,b.bid NULLS LAST;