COMP 630

Assignment: Database Refactoring
Purpose
This assignment will assess your ability to
• perform simple database refactoring in a disciplined way
• create the proper SQL queries
Task
Consider the following database relations Order and OrderItem,
1. name the refactoring pattern(s) you use for every step. Multiple patterns may apply.
2. list every step in the order of changing from the original table structure into new table structure.
Assume the data type of OrderID, StoreID, CustomerNumber, OrderItemNumber and OrderQuantity is
number (integer).
a. When you describe the schema update or data migration mechanic in each step, make sure to
include the operations in words and SQL scripts needed to achieve the desired objective for
every step
3. (Option) Execute your SQL scripts in a database platform and show the result in screenshot.
Original Order and OrderItem Relations:

Follow the format used in the book but tailor your description to this specific database schema. Please note that
the refactoring request may require the application of multiple refactoring pattern(s). You are expected to
discuss the refactoring pattern(s) required to achieve each refactoring request in the proper order. Show the
affected relations in the schema after each refactoring.
Reference:
The following Website provides an excellent resource for data refactoring:
http://www.agiledata.org/essays/databaseRefactoringCatalog.html