Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

create relationship one-to-one

$
0
0
Hello everyone

I am trying create relationship one to one between table PERSON and PESEL

PERSON:

id_person,
name_person,
surname_person

PESEL

id_pesel
number_pesel

and I went write syntax to creating relation:

CREATE TABLE PESEL(
id_pesel int primary key,
number_pesel varchar(11) not null);

CREATE TABLE PERSON(
id_person int primary key,
name_person varchar(15) not null,
surname_person varchar(20) not null,
id_pesel int not null);

ALTER TABLE PERSON ADD CONSTRAINT FK_PESEL FOREIGN KEY(id_pesel) REFERENCES PESEL(id_pesel)

this is okay?

I greet,

Viewing all articles
Browse latest Browse all 13329

Trending Articles