If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Help design a simple database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-26-11, 03:05
ioigoume ioigoume is offline
Registered User
 
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
Reply With Quote
  #2 (permalink)  
Old 05-26-11, 08:53
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
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"
Reply With Quote
  #3 (permalink)  
Old 05-26-11, 09:38
ioigoume ioigoume is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 05-26-11, 10:04
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
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"
Reply With Quote
  #5 (permalink)  
Old 05-26-11, 10:14
ioigoume ioigoume is offline
Registered User
 
Join Date: May 2011
Posts: 3
Thanks a lot for your replies i will start implementing and see how it will go!

ioigoume
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On