的值如果我有兩個表是這樣的:獲取的外鍵引用
CREATE TABLE Director
(
`DirectorNr` INTEGER NOT NULL,
`First Name` VARCHAR (20),
`Last Name` VARCHAR (30),
`Age` INTEGER,
`Movies` INTEGER,
PRIMARY KEY(DirectorNr)
);
CREATE TABLE Movies
(
`MovieNr` INTEGER NOT NULL,
`Title` VARCHAR (100),
`Genre` VARCHAR (30),
`USK` INTEGER,
`Director` INTEGER NOT NULL,
`Length` INTEGER,
`Release` DATE,
PRIMARY KEY (MovieNr),
FOREIGN KEY (Director)
REFERENCES Director (DirectorNr)
);
INSERT INTO Director
VALUES (1, 'Peter', 'Jackson', 52, 17);
INSERT INTO Movies
VALUES (1, 'The Hobbit: An Unexpected Journey', 'Fantasy', 12, 1, 169, '2012/12/12');
如何我可以通過外鍵得到了導演的名字,用SELECT?
事情是這樣的:
SELECT `Director.First Name` `Director.Last Name` FROM Movies ...
請不要暗示遺留隱式連接語法。 –