oracle - Implement One-to-One Relationship in SQL without sharing PKs? -
oracle - Implement One-to-One Relationship in SQL without sharing PKs? -
i want define one-to-one relationship between 2 tables in database, let's person , address.
create table person ( pid int primary key, name varchar(20), occupation varchar(20)); create table address ( street varchar(30) primary key, city varchar(10), state varchar(2), zip varchar(5)); i want link these two, each person has 1 address, , each address has 1 person living there (it simplified example).
most solutions have found recommend having 2 tables share primary key, or changing pk of address fk referencing pk of person. don't want though, because still want both street , pid unique on own.
how go approaching this?
you'd have unique key on person, primary key, , primary key of address reference that.
sql oracle
Comments
Post a Comment