Results 1 to 5 of 5
  1. #1
    Join Date
    May 2011
    Posts
    3

    Question Help design a simple database

    Goodevening everybody,
    i am new to this community and i really need some help for a very easy task. I am trying to create a database.This database will store the following data:

    Personal info:Name,Surname,City,Age,...
    Next of kin:Name, address, phone
    Measurementdata:Action,...data... ( the variable are many and of no importance considering the question i have )
    Measurement info: Who did the measurement, date of the measurement, ...

    My initial thought was to make 4 tables. The main table would be the one with the personal info and having immediate relationship with the next of kin table. The other two tables would be the ones that hold the data from the measurement and the rellationship with the personal info would be through through a foreign key.

    After reconsidering i think i should make the project using 2 tables. One concerning the personal info and the other concerning measurement data+info.

    Now my question.Whether i choose this structure of the other i come to the same problem. There is no unique identifier to make a primary key to the one table and and it manually to the other. I thought using a variable type int that would encrement after each insert but what would i do if i want to insert values in the measurement data+info table and later insert the personal info and use the primary key to update the foreigh key?

    This problem really troybles my a lot and i think it is more a design one!!!

    Please help with a suggetion? What is a common procedure for such an implemantation?

    iogoume

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    If you want to insert data into the measurement tables that relates to people who do not exist yet in the persons table, and you have no natural key on the person data set, then you are screwed.
    Why would you enter measurements on people you don't know anything about yet?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    May 2011
    Posts
    3

    ?

    I don not want to give the user many freedoms, but the problem is that if i do not the programm becomes compicated! The simplest the better and the more automatic the less a user can destroy.

    what is your suggetion?what would you do?
    ioigoume

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    I would enforce relational integrity, and insist that a person exist in the database before measurements can be added for that person.
    I would give each person a unique code to identify them. A system login often works well for this, as it must be unique for each user on a network. Unique emails might also work.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    May 2011
    Posts
    3
    Thanks a lot for your replies i will start implementing and see how it will go!

    ioigoume

Posting Permissions

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