【发布时间】:2021-09-26 01:04:15
【问题描述】:
这是我的桌子:
创建表国家( country_id number(5) 主键, 国家 varchar2(36) );
create table city( city_id number(5) primary key, country_id number(5) constraint city_country_fk references country(country_id) NOT NULL, city varchar2(36) ); SQL> desc airportdemodata; Name Null? Type ----------------------------------------- -------- ---------------------------- AIRPORT_ID NOT NULL NUMBER(5) IATA_CODE VARCHAR2(3) CITY VARCHAR2(36) COUNTRY VARCHAR2(36) AIRPORT VARCHAR2(58)
我将来自 airportdemodata 的国家/地区插入到国家/地区表中,如下所示:
INSERT INTO country (country)
SELECT unique(country) from airportdemodata;
效果很好。
现在我正在尝试通过将 airportdemodata.country 与 country.country 匹配来将 airportdemodata.city 复制到 city.city(country_id,city) 中。我试过这样:
SQL> SELECT a.unique(city), b.country_id FROM airportdemodata a, country b where a.country=b.country;
SELECT a.unique(city), b.country_id FROM airportdemodata a, country b where a.country=b.country
*
ERROR at line 1:
ORA-01747: invalid user.table.column, table.column, or column specification
【问题讨论】:
标签: sql oracle oracle11g oracle-xe