Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012
    Posts
    33

    Unanswered: create relationship one-to-one

    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,
    Last edited by dexter90; 09-01-12 at 06:41.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >I am trying create relationship one to one between table PERSON and PESEL
    then in a normalized table design only a SINGLE table would exist.
    all data for a single entity would exist within a single row.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •