Appendix B – Getting Started with Oracle Database XE
11. In the WP SQL Worksheet window, type and run the following SQL query to verify the
proper importing of the COMPUTER_ASSIGNMENT data:
12. Next we need to create the foreign keys using SQL ALTER TABLE statements. Note that we
link to both the EMPLOYEE table using EmployeeNumber and to the COMPUTER table using
SerialNumber. What referential integrity constraints should we use? For EMPLOYEE,
EmployeeNumber is a surrogate key and is never updated. Further, WP never drops
employee records because of record keeping requirements. Therefore, we will never
cascade updates or deletes for this primary key. FOR COMPUTER, SerialNumber never
changes. However, when we remove a computer from the WP computer inventory, we do
not need to keep historical records of having had that computer. Therefore, while we do not
cascade updates, we will cascade deletions for this primary key. The SQL for this is covered
in Appendix E in more detail:
13. The one remaining task for the COMPUTER_ASSIGNMENT table is to set the primary key.
The ALTER TABLE syntax for accomplishing this will be covered in Appendix E, but here is the
solution:
14. We can verify correct importing by running an SQL query, whose results are shown below: