SQL脚本问题

时间:2017-10-15 13:38:39

标签: sql oracle

这是我在oracle iacademy上运行此脚本时收到的错误 ORA-00905:缺少关键字 我无法弄清楚脚本中缺少的关键字是什么。问题主要指向SELECT指令。

DROP TABLE c_furnizori;
DROP TABLE c_adrese;

CREATE TABLE C_ADRESE
    (ida NUMBER(4,0),
     localitate VARCHAR(30),
     strada VARCHAR(30),
     numar NUMBER(3,0)    
    );

CREATE TABLE C_FURNIZORI
    (idf NUMBER(4,0),
     numef VARCHAR(20),
     ida NUMBER(4,0)
    );

ALTER TABLE C_ADRESE ADD CONSTRAINT PK_ADRESE PRIMARY KEY (ida);
ALTER TABLE C_FURNIZORI ADD CONSTRAINT PK_FURNIZORI PRIMARY KEY (idf);

ALTER TABLE C_FURNIZORI ADD CONSTRAINT FK_FURNIZORI_ADRESAFURNIZORI FOREIGN KEY (ida) REFERENCES C_ADRESE(ida);

INSERT INTO C_ADRESE (ida,localitate,strada,numar) VALUES ('1','Sighisoara','Aurel Vlaicu','33');
INSERT INTO C_ADRESE (ida,localitate,strada,numar) VALUES ('2','Cluj Napoca','Mihail Kogalniceanu','2');
INSERT INTO C_ADRESE (ida,localitate,strada,numar) VALUES ('3','Bucuresti','Mihai Eminescu','1');
INSERT INTO C_ADRESE (ida,localitate,strada,numar) VALUES ('4','Brasov','Suisul Castelului','4');
INSERT INTO C_ADRESE (ida,localitate,strada,numar) VALUES ('5','Tg. Mures','Clinicii','124');

INSERT INTO C_FURNIZORI (idf,numef,ida) VALUES ('1','Super Truck','3');
INSERT INTO C_FURNIZORI (idf,numef,ida) VALUES ('2','Autoeco','1');
INSERT INTO C_FURNIZORI (idf,numef,ida) VALUES ('3','GalaxyAuto','5');
INSERT INTO C_FURNIZORI (idf,numef,ida) VALUES ('4','Epiesa','2');
INSERT INTO C_FURNIZORI (idf,numef,ida) VALUES ('5','Eurocar Auto','4');

SELECT C_FURNIZORI.numef AS "Nume furnizor", C_ADRESE.localitate AS "Localitate", C_ADRESE.strada AS "Strada", C_ADRESE.numar AS "Numar" 
FROM C_FURNIZORI JOIN C_ADRESE
ON C_FURNIZORI.ida = C_ADRESE.ida;

0 个答案:

没有答案