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,
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,