postgresql inner join code example
Example 1: update with inner join postgres
update xtable x
set col1 = y.col1
from ytable y
where y.x_id = x.id;
Example 2: psql join
SELECT *
FROM weather INNER JOIN cities ON (weather.city = cities.name);
Example 3: postgres join
-- This is in postgreSQL
-- We have tableA and tableB, x is primary key in tableA and also
-- a foreign key in tableB as y
SELECT * FROM tableA JOIN tableB ON tableA.x = tableB.y;
-- This will select all the columns from both tables that share a key