I created a fiddle to solve this question:
https://www.db-fiddle.com/f/3MGCAaL1YU4ZdkRGfSwPPK/0
First the tables are created:
CREATE TABLE TableA (carModel varchar(20),year int);
INSERT INTO TableA VALUES('x',1999),('y',2005);
CREATE TABLE TableB (computer varchar(20),price int);
INSERT INTO TableB VALUES('t',1000),('z',2000);
CREATE TABLE TableC (food varchar(20),cals int);
INSERT INTO TableC VALUES('b',500),('y',600);
And then queried:
WITH A AS (
SELECT ROW_NUMBER() OVER() R,
carModel,year
FROM TableA),
B AS (
SELECT ROW_NUMBER() OVER() R,
computer,price
FROM TableB),
C AS (
SELECT ROW_NUMBER() OVER() R,
food,cals
FROM TableC)
SELECT A.carModel, A.year, B.computer, B.price, C.food,C.cals
FROM A
INNER JOIN B ON B.R=A.R
INNER JOIN C ON C.R=A.R;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…