此图显示了方案 HR 中的关系表和每个表中的列,以及这些表之间的相关性。
“雇员”表具有以下属性:
列:employee_id(主键),first_name,last_name,电子邮件,phone_number,hire_date,job_id,薪金,commission_pct,manager_id,department_id。
关系:
列 department_id 将表雇员的每一行与表部门中 department_id 的一个值关联起来
在 job_id 列中,雇员表的每一行都与表职务中仅有一个值 job_id 相关。
列 employee_id 将雇员表的每一行与 job_history 表中 employee_id 的一行或多行关联起来
列 manager_id 通过匹配的 employee_id 不引用雇员表的任何一行或其它一行;请注意,公司主管通常不会有经理
其它关系:
列 employee_id 将表雇员的行与表 oe.orders 中的 sales_rep_id 列关联
列 employee_id 将表雇员的行与表 oe.customers 中的 account_mgr_id 列关联
作业表具有以下属性:
列:job_id(主键)、job_title、min_salary 和 max_salary
关系:
job_id 列将表作业的每一行与表雇员的 jobs_id 列中的相应值关联起来
列 job_id 将表作业的行或多行与表 job_history 的 jobs_id 列中的相应值关联
job_history 表具有以下属性:
列:employee_id 和 start_date(组合主键)、end_date、job_id 和 department_id。
关系:
每个 job_history 记录都通过 employee_id 与表雇员中的记录关联。
departments 表具有以下属性:
列:department_id(主键)、department_name、manager_id 和 location_id。
关系:
列 department_id 将表部门的每一行与表雇员中没有一行或多行具有 department_id 的对应值相关联。
列 manager_id 将表部门的每一行与表雇员中的一行联系起来,该行具有 employee_id 的对应值。
列 location_id 将表部门的每一行与表位置的一行关联,该行具有 location_id 的对应值。
位置表具有以下属性:
列:location_id(主键)、street_address、postal_code、城市、state_province 和 country_id。
关系:
列 location_id 将表位置的每一行与表部门中具有 location_id 相应值的每一行或多行关联。
列 country_id 将表位置的每一行与表国家(地区)中具有相应 country_id 值的行关联。
其它关系:
列 location_id 将表位置的行与表 eo.warehouses 中具有 loacation_id 的对应值的行或多行关联。
“国家/地区”表具有以下属性:
列:country_id(主键)、country_name 和 region_id。
关系:
列 region_id 将表国家/地区的每一行与表区域中具有 region_id 相应值的行关联。
列 country_id 将表国家/地区的每一行与表位置中具有 country_id 相应值的无行或多行关联。
区域表具有以下属性:
列:region_id(主键)和 region_name。
关系:
列 region_id 将表区域的行与表国家/地区中具有 region_id 相应值的行或多行关联。
此图还介绍了方案 OE,并显示了两个方案之间的依赖关系。
order_items 表具有以下属性:
列:order_id(主键)、line_item_id、product_id、unit_price 和数量。
关系:
列 order_id 将表 order_items 的一行或多行与表的一行相关联,且对应的值为 order_id。
列 product_id 将表 order_items 的一行或多行与表 product_information 的一行关联,对应的值为 product_id。
“订单”表具有以下属性:
列:order_id(主键),order_date,order_mode,customer_id,order_status,order_total,sales_rep_id,promotion_id
关系:
列 order_id 将表的一行与表 order_items 的一行或多行与 order_id 的相应值关联。
列 customer_id 将表的一个或多个行与表顾客的一行(对应的值为 customer_id)关联。
其他关系:
列 sales_rep_id 将表的一个或多个行与表 hr.employees 的一行关联,对应的值为 employee_id。
product_information 表具有以下属性:
列:product_id(主键),product_name,product_description,category_id,weight_class,warranty_period,supplier_id,product_status,list_price,product_id,min_price 和 catalog_url
关系:
列 product_id 将表 product_information 的一行与表 order_items 的一行或多行关联,并对应的值为 product_id。
列 product_id 将表 product_information 的一行与表 product_descriptions 的零行或多行关联,并对应的值为 product_id。
列 product_id 将表 product_information 的一行与表库存中的零行或多行关联,且对应的值为 product_id。
product_descriptions 表具有以下属性:
列:product_id 和 language_id(复合主键)、translated_name 和 translated_description
关系:
列 product_id 将表 product_descriptions 的一行或多行与表 product_information 的一行关联,对应的值为 product_id。
库存表具有以下属性:
列:product_id 和 warehouse_id(复合主键)和 quantity_on_hand。
关系:
列 product_id 将表清单的一行或多行与表 product_information 的一行关联,对应的值为 product_id。
列 warehouse_id 将表清单中的一行或多行与表仓库中的一行关联,对应的值为 warehouse_id。
“顾客”表具有以下属性:
列:customer_id(主键)、cust_first_name、cust_last_name、cust_address、phone_numbers、nls_language、nls_territory、credit_limit、cust_email、account_mgr_id、cust_geo_location、date_of_birth、marital_status、性别和 income_level
关系:
列 customer_id 将表客户的行与表订单中的一行或多行关联,且对应的值为 customer_id。
其他关系:
列 acct_mgr_id 将表顾客的一行或多行与表 hr.employees 的一行关联,且对应的值为 employee_id。
“仓库”表具有以下属性:
列:warehouse_id(主键)、warehouse_spec、warehouse_name、location_id 和 wh_geo_location
关系:
列 warehouse_id 将表仓库的行与表库存的一个或多个行关联,对应的值为 warehouse_id。
其他关系:
列 location_id 将表仓库的一行或多行与表 hr.locations 的一行关联,对应的值为 location_id。