附件说明:
XML Countries Database
此数据库用于考试, “XML Countries Database”, 由下面三个表组成:
- CONTINENTS 包括两个列: continent ID (CID) , continent name (CONTINENT).
- COUNTRIES 是核心表, 包括 country ID, continent ID (CONTINENT),国家的名称 (NAME), 和xml列 EXTNAME. EXTNAME 的结构在下面内容中描述。
- C_INFO (country information) 在xml列 (INFO) 中包括额外的信息. 通过country ID (CID) 实现对contries表的参照引用。
用于创建数据表的DDL
我们建议把数据加载到新的数据库中,可以采用如下的语句。然后创建数据表。
--create db xc;
--connect to xc;
create table continents(cid int unique not null, continent varchar(40));
create table countries(id int unique not null, continent int,name varchar(100),extname xml);
create table c_info(cid int, info xml);
表创建完成后,我们需要导入数据,采用附件中的数据文件,执行下面的命令可以完成数据导入。注意需要在del文件所在的目录下执行该命令(注意命令中的双引号是中文的。执行时需要修改。)。
import from “continents.del” of del insert into continents;
import from “countries.del” of del insert into countries;
import from “c_info.del” of del insert into c_info;
XML 文档结构
COUNTRIES 表中的EXTNAME列有如下的结构:
<country>
<country_name>
<long>Republic of Example</long>
<short>Example</short>
<local_long>Bundesrepublik Beispiel</local_long>
<local_short>Beispiel</local_short>
</country_name>
<capital>Sample Town</capital>
<languages>Samplastic, English</languages>
</country>
C_INFO表中的INFO列有如下的结构
<country cid=”9999”>
<border_countries>United Samples, Federation of Examples</border_countries>
<population>10</population>
<area unit="sq km">
<total>20</total>
<land>19</land>
<water>1</water>
</area>
<boundaries unit="km">24</boundaries>
<coastline unit="km">4</coastline>
<currency>RSD</currency>
<fiscal_year> calendar year </fiscal_year>
<ports_and_terminals>Exampleport</ports_and_terminals>
<elevation_extremes>
<highest_point>Mount Example 2,005 m</highest_point>
<lowest_point>Sampleport - 10 m</lowest_point>
</elevation_extremes>
</country>
注意:有些数值可能包含空格,需要作为查询的一部分来处理。
答题说明:
在下列所有任务中,如果希望查询所在洲名称,那么请看表“continents”中的“CONTINENT”列;如果希望查询国家名称,那么请看表格“COUNTRIES”中的“NAME”列。
注意:如果各数值中含有空格,可能会对查询结果产生影响。
|