Home » Developer & Programmer » Designer » one to one relatioship
one to one relatioship [message #329308] Wed, 25 June 2008 00:28 Go to next message
kris123
Messages: 5
Registered: June 2008
Junior Member
Hi

I have a big table with row size 50000bytes.I want to split into three tables with one-to one.I have empid pk in the main table do all table shall have this field.how do i keep relationship with other tables.Do I need to connect each one with all dependents
Re: one to one relatioship [message #329315 is a reply to message #329308] Wed, 25 June 2008 01:05 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
What on earth are you storing in a 50kByte row?
Are you sure you have your design normalized?
Re: one to one relationship [message #329824 is a reply to message #329308] Thu, 26 June 2008 12:03 Go to previous message
hhelgen
Messages: 12
Registered: April 2007
Location: Duluth MN
Junior Member
Create your other two tables with a primary key of empid. Also, make the empid in the second and third table a foreign key to the main table.

Then split your columns into the second and third tables. Try code something like this to create the second table. Backup or export your schema just in case. Copy the data from the first table columns into the same columns in the second table. The drop the columns from the first table.

CREATE TABLE MYSCHEMA.EMPLOYEE2 (EMPID VARCHAR2(10) NOT NULL,
    COLUMNAFROMTABLE1 VARCHAR2(10) NOT NULL, 
    COLUMNBFROMTABLE1 VARCHAR2(10) NOT NULL, 
    PRIMARY KEY(EMPID), 
    CONSTRAINT FK_EMP1_EMP2 FOREIGN KEY(EMPID) 
    REFERENCES MYSCHEMA.EMPLOYEE(EMPID))  
    TABLESPACE USR; 

Previous Topic: merging Databases on Oracle Design Editor
Next Topic: Generalization relationship
Goto Forum:
  


Current Time: Sun Nov 24 04:04:41 CST 2024