Professional Documents
Culture Documents
Sports League Step 2 Student
Sports League Step 2 Student
com
Project Scenario:
You are a small consulting company specializing in database development. You have just been awarded the
contract to develop a data model for a database application system for a small retail store called Oracle
Baseball League (OBL).
The Oracle Baseball League store serves the entire surrounding community selling baseball kit. The OBL has
two types of customer, there are individuals who purchase items like balls, cleats, gloves, shirts, screen printed
t-shirts, and shorts. Additionally customers can represent a team when they purchase uniforms and equipment
on behalf of the team.
Teams and individual customers are free to purchase any item from the inventory list, but teams get a discount
on the list price depending on the number of players. When a customer places an order we record the order
items for that order in our database.
OBL has a team of three sales representatives that officially only call on teams but have been known to handle
individual customer complaints.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
2
Data modeling allows you to understand and apply the Oracle naming conventions of a Conceptual Data Model
and apply them in the creation of a Physical Data Model. The Physical model will represent the information
stored in the ERD in a way that a relational database can be easily produced.
Using the ERD that you have produced throughout this project (or the suggested start point in this document)
create a table mapping document that will represent the transformation of the Conceptual Data Model
terminology to that of the Physical Data Model.
3. The Optionality column must contain an asterisk (*) if the column is mandatory and a lowercase "o" if it
is optional.
4. The third column is for the column name this should match the singular attribute name but with spaces
replaced with underscores. The name of the column should not include the entity/table name because
columns are qualified with the table name
5. Remember that you have to follow the naming conventions at all stages and you have to be consistent
in your naming approach.
6. Be careful not to try to assign keywords as table/column names as this will cause you problems when
you try to create the Physical model.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
3
The first table (customers) has been completed for you as an example.
A single table implementation has been used to represent the super/subtypes shown in the CUSTOMER entity.
Using the given example and the following template to complete a separate table for every entity in your
Conceptual Data Model.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
4
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
5
Data modeling allows you to understand and apply the Oracle naming conventions of a Conceptual Data Model
and apply them in the creation of a Physical Data Model. The Physical model will represent the information
stored in the ERD in a way that a relational database can be easily produced.
Using the table mapping document that you created in part 1 of this exercise complete the tables to also show
appropriate data types and sizes.
The first table (customers) has been completed for you as an example.
A single table implementation has been used to represent the super/subtypes shown in the CUSTOMER entity.
pk * ctr_number VARCHAR2 6
uk * email VARCHAR2 50
* first_name VARCHAR2 20
* last_name VARCHAR2 30
* phone_number VARCHAR2 11
* current_balance NUMBER 6,2
uk o loyalty_card_number VARCHAR2 6
fk1 o tem_id VARCHAR2 4
fk2 o sre_id VARCHAR2 4
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
6
Using the given example and the following template complete a separate table for every entity in your
Conceptual Data Model that will show the data type and size (if appropriate) for each attribute..
Sample Table Data - The following tables represent the first row of data in each table you should place the
data types and sizes in the appropriate table that you created in Task 1.
customers ctr
loyalty_c
first_ last_ Phone_ current_ tem_i sre_i
ctr_number email ard_
name name number balance d d
number
bob.thornbe
01234567 sr00
c00001 rry@heatma Robert Thornberry 150.00 t001
898 1
il.com
customers_addresses
id address_line_1 address_line_2 city postal_code ctr_number
ca0101 83 Barrhill Drive Liverpool Lp79HJK c00001
teams
id name number_of_players discount
t001 Rockets 25 10
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
7
sales_representatives
id email first_name last_name phone_number commission_rate supervisor_id
sr01 chray@obl.com Charles Raymond 134598761 5 sr01
sales_representatives_address
id address_line_1 address_line_2 city postal_code
sr01 12 Cherry Lane Denton Detroit DT48211
orders odr
id date time number_of_units ctr_number
or0101250 17-Jun-2017 08:32:30 10 c00001
ordered_items oim
quantity_ordered quantity_shipped odr_id itm_number
5 5 or0101250 Im01101025
Items itm
Itm_number name description category color size ilt_id
Im01101025 gloves catcher mitt clothing brown m il010230124
Inventory_list ilt
id unit_cost units_on_hand
il010230124 2.50 100
price_history
start_date start_time price end_date end_time itm_number
17-Jun-2017 09:00:00 4.99 Im01101025
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
8
Oracle SQL Developer Data Modeler allows you to create Entities, attributes, and UIDs with correct optionality
and cardinality, Supertype and subtype entities as well as Arcs, hierarchical, barred, and recursive relationships.
1. The first step in building a logical model (ERD) in Oracle SQL Developer Data Modeler is to click the
Logical tab.
a. If you do not see the Logical tab, then perform the following steps:
b. Right-click the Logical Model in the browser.
c. Select Show.
2. Create entities.
4. Create mandatory or optional attributes for each entity (at this stage don’t apply any data types to the
attributes). Add comments to explain the attribute where necessary. Do not include any foreign key
attributes as these are added through the relationships.
5. Create the relationship between the entities. You can create M:N Relation (many-to-many), 1:N
Relation (one-to-many), 1:N Relation identifying (one-to-many barred) or 1:1 Relation (one-to-one).
a. Set the source entity and target entity for the relationship.
b. Name the relationship following the convention of naming the entity on the one side followed
by a colon and naming the second entity in the relationship (customer : customer address).
c. Use name on source and name on target to add the labels to the relationships. These won’t be
displayed on the logical model but will be shown on the physical model.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
9
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
10
In this step you will take your completed logical data model that was created using Oracle SQL Data Modeler
and engineer it to a Relational Model. The relational model forms the basis for the physical database design.
Create a relational model in Oracle SQL Data Modeler by following these steps:
8. Update the attributes in your entities to include their data type and size.
a. Double click the entity to access the properties.
b. Choose attributes from the left menu
c. Select each attribute and choose logical from the properties window to activate the data type
drop down.
d. Choose the appropriate data type (VARCHAR to represent text, there is no VARCHAR2 option).
e. Place the size in the size box.
f. Any attributes that have been brought in as foreign keys can be renamed in the relational
model by double clicking them and setting their preferred abbreviation.
g. Any attributes are names using keywords should have a preferred abbreviation assigned.
h. You cannot assign unique keys at this stage.
i. For any supertype entities set the subtree generation to single table in the subtype property.
10. Ensure that all values are as expected by comparing the logical and relational information in tree view.
Correct the values as necessary.
11. In the general option tab click engineer co-ordinates to lock the diagram in place and avoid overlap.
13. Expand the Relational Model node in the object browser to view the objects that you created.
14. Move the node objects to ensure that all information is visible on your diagram.
15. Check the result matches your table map and Save your work.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
11
Task Instructions
Use the completed table mapping document produced in a previous exercise to assign the data types and sizes.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
12
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
13
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
14
In this exercise you will take your completed relational model and create the remaining constraints.
1. Identify the tables that have unique columns that have still to be created.
a. Right click the table and choose properties.
b. Select Unique Constraints from the menu.
c. Click the green cross to add a new unique constraint.
d. Use the table short name_column_name_constraint type format to name your constraints.
e. Select the column that is to be set as unique and click the arrow to add it to the selected column.
f. Click OK.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
15
Task Instructions
Use the completed table mapping document produced in a previous exercise to assign the constraints.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
16
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
17
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.
18
In this exercise you will take your completed relational model that you created in the previous exercise and
create the SQL script that will generate your tables in APEX.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their
respective owners.