Description of the illustration comsc008.eps
This figure shows the relational tables in schema HR and the columns in each table, as well as dependencies between the tables.
The employees
table has the following attributes:
-
Columns:
employee_id
(primary key),first_name
,last_name
,email
,phone_number
,hire_date
,job_id
,salary
,commission_pct
,manager_id
,department_id
. -
Relationships:
-
Column
department_id
relates each row of the tableemployees
to exactly one value ofdepartment_id
in the tabledepartments
-
Column
job_id
relates each row of the tableemployees
to exactly one value ofjob_id
in the tablejobs
-
Column
employee_id
relates each row of the tableemployees
to none or more rows ofemployee_id
in thejob_history
table -
Column
manager_id
references none or one other row of theemployees
table through a matchingemployee_id
; note that a head of the company would typically not have a manager
-
-
Other relationships:
-
Column
employee_id
relates rows of the tableemployees
tosales_rep_id
columns in the tableoe.orders
-
Column
employee_id
relates rows of the tableemployees
toaccount_mgr_id
columns in the tableoe.customers
-
The jobs
table has the following attributes:
-
Columns:
job_id
(primary key),job_title
,min_salary
, andmax_salary
-
Relationships:
-
Column
job_id
relates each row of the tablejobs
to the corresponding values in thejobs_id
column of the tableemployees
-
Column
job_id
relates none or more rows of the tablejobs
to the corresponding values in thejobs_id
column of the tablejob_history
-
The job_history
table has the following attributes:
-
Columns:
employee_id
andstart_date
(a composite primary key),end_date
,job_id
, anddepartment_id
. -
Relationships:
-
Each
job_history
record is associated with a record in the tableemployees
through theemployee_id
.
-
The departments
table has the following attributes:
-
Columns:
department_id
(primary key),department_name
,manager_id
, andlocation_id
. -
Relationships:
-
Column
department_id
relates each row of the tabledepartments
to none or more rows of the tableemployees
that have corresponding values fordepartment_id
. -
Column
manager_id
relates each row of the tabledepartments
to a row of the tableemployees
that has the corresponding value foremployee_id
. -
Column
location_id
relates each row of the tabledepartments
to a row of the tablelocations
that has the corresponding value forlocation_id
.
-
The locations
table has the following attributes:
-
Columns:
location_id
(primary key),street_address
,postal_code
,city
,state_province
, andcountry_id
. -
Relationships:
-
Column
location_id
relates each row of the tablelocations
to none or more rows of the tabledepartments
that have the corresponding values forlocation_id
. -
Column
country_id
relates each row of the tablelocations
to a row in the tablecountries
that has the corresponding value forcountry_id
.
-
-
Other relationships:
-
Column
location_id
relates rows of the tablelocations
to none or more rows of the tableeo.warehouses
that have the corresponding values forloacation_id
.
-
The countries
table has the following attributes:
-
Columns:
country_id
(primary key),country_name
, andregion_id
. -
Relationships:
-
Column
region_id
relates each row of the tablecountries
to a row in the tableregions
that has the corresponding value forregion_id
. -
Column
country_id
relates each row of the tablecountries
to none or more rows in the tablelocations
that have the corresponding values forcountry_id
.
-
The regions
table has the following attributes:
-
Columns:
region_id
(primary key), andregion_name
. -
Relationships:
-
Column
region_id
relates rows of the tableregions
to none or more rows of the tablecountries
that have the corresponding values forregion_id
.
-
This graphic also describes schema OE
and shows the dependencies between the two schemas.
The order_items
table has the following attributes:
-
Columns:
order_id
(primary key),line_item_id
,product_id
,unit_price
, andquantity
. -
Relationships:
-
Column
order_id
relates one or more rows of the tableorder_items
to one row of the tableorders
with the corresponding value oforder_id
. -
Column
product_id
relates one or more rows of the tableorder_items
to one row of the tableproduct_information
with the corresponding value ofproduct_id
.
-
The orders
table has the following attributes:
-
Columns:
order_id
(primary key),order_date
,order_mode
,customer_id
,order_status
,order_total
,sales_rep_id
,promotion_id
-
Relationships:
-
Column
order_id
relates one row of the tableorders
to one or more rows of the tableorder_items
with the corresponding values of theorder_id
. -
Column
customer_id
relates one or more rows of the tableorders
to one row of the tablecustomers
with the corresponding value of customer_id.
-
-
Other Relationships:
-
Column
sales_rep_id
relates one or more rows of the tableorders
to one row of the tablehr.employees
with the corresponding value ofemployee_id
.
-
The product_information
table has the following attributes:
-
Columns:
product_id
(primary key),product_name
,product_description
,category_id
,weight_class
,warranty_period
,supplier_id
,product_status
,list_price
,product_id
,min_price
, andcatalog_url
-
Relationships:
-
Column
product_id
relates one row of the tableproduct_information
to one or more rows of the tableorder_items
with the corresponding value ofproduct_id
. -
Column
product_id
relates one row of the tableproduct_information
to zero or more rows of the tableproduct_descriptions
with the corresponding value ofproduct_id
. -
Column
product_id
relates one row of the tableproduct_information
to zero or more rows of the tableinventories
with the corresponding value ofproduct_id
.
-
The product_descriptions
table has the following attributes:
-
Columns:
product_id
andlanguage_id
(composite primary key),translated_name
, andtranslated_description
-
Relationships:
-
Column
product_id
relates one or more rows of the tableproduct_descriptions
to a row of the tableproduct_information
with the corresponding value ofproduct_id
.
-
The inventories
table has the following attributes:
-
Columns:
product_id
andwarehouse_id
(composite primary key), andquantity_on_hand
. -
Relationships:
-
Column
product_id
relates one or more rows of the tableinventories
to one row of the tableproduct_information
with the corresponding value ofproduct_id
. -
Column
warehouse_id
relates one or more rows of the tableinventories
to one rows of the tablewarehouses
with the corresponding value ofwarehouse_id
.
-
The customers
table has the following attributes:
-
Columns:
customer_id
(primary key),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
,gender
, andincome_level
-
Relationships:
-
Column
customer_id
relates rows of the tablecustomers
to one or more rows of the tableorders
with the corresponding value ofcustomer_id
.
-
-
Other Relationships:
-
Column
acct_mgr_id
relates one or more rows of the tablecustomers
to one row of the tablehr.employees
with the corresponding value ofemployee_id
.
-
The warehouses
table has the following attributes:
-
Columns:
warehouse_id
(primary key),warehouse_spec
,warehouse_name
,location_id
, andwh_geo_location
-
Relationships:
-
Column
warehouse_id
relates rows of the tablewarehouses
to one or more rows of the tableinventories
with the corresponding value ofwarehouse_id
.
-
-
Other Relationships:
-
Column
location_id
relates one or more rows of the tablewarehouses
to one row of the tablehr.locations
with the corresponding value oflocation_id
.
-