Copying a Table from DEMO:

I want to copy the EMPLOYEE table that is under DEMO and be able to use it as SCOTT. First, I went into NAVIGATOR and selected Personal Oracle 7/Local Database/Table.

Before I could copy, I need to look at the properties of the table to check and see if there were foreign key constraints that linked to another table. To do this I right clicked on EMPLOYEE (it is in the right window when I do this) and selected Properties. I then clicked on the Design tab and scrolled over to foreign key. There are three things listed, an internal connection back to EMPLOYEE and a connection to JOB and DEPARTMENT. That means I am going to have to bring these tables over before I can bring over EMPLOYEE. But first I need to check for foreign keys in these tables. JOB is okay but EMPLOYEE has a link to LOCATION so I need to copy LOCATION first. Now, I check LOCATION and determine that it has no foreign keys.

I now want to copy LOCATION, then either JOB or DEPARTMENT and finally EMPLOYEE.

To do the copy, I right click on the table name and select COPY. Next I right click on table under local database in the left window and select PASTE. A window comes up asking for the new name and the owner. The first time I type LOCATION as the name and SCOTT as the owner. I keep the default to select structure and data selected.

The first window I get says there are constraints and asks if I want to copy them. I respond yes. One of the windows asks if I want the foreign schema replaced with SCOTT and I answer YES so that references will be to the other tables I am copying over under SCOTT and not to tables under DEMO.

Note: If I had wanted to just copy EMPLOYEE without the foreign key constraints, I could have done that and answered NO to the constraints question and EMPLOYEE would be copied with no foreign keys.