简体   繁体   中英

mysql db normalization help required

please forgive me as Ive been confused and I need your help in normalization of this next mysql database (will work on it along with php). If this is not allowed to post it then ignore :)

  • I've a need to record large number students to visit a library in order to document it and create analysis and reports later on.
  • These visits will hold lots of data and criteria for each student single visit, and it will be filled by different supervisor people because the student will visit more than one section.
  • Hence, there will be some limitations for entry and disallowing certain parts of the form to be accessed by certain users...etc.
  • My plan is to have a single form with some initial student information and select boxes, radio, checkboxes, and notes as free text, for each visit, as i mentioned, using php as frontend

This is what i have in mind, 2 main tables + other smaller tables to hold the select boxes data as foreign keys.

TABLE1: STUDENTS

  1. student_id
  2. student_number
  3. student_name
  4. student_gender
  5. student_grade
  6. student dateofbirth
  7. student age

TABLE2: VISITS

  1. studnet_id (referring and pulling student info from TABLE1)
  2. date_of_visit
  3. have_did_this_during_the_visit (DropDown)
  4. psychological_reaction (checkboxes) 5 was_wearing_well (yes not selectbox)

And so on, more than 50 criteria to measure for each visit

This way, will have finally 2 forms, one to add student, and one to deal with visits...

Although, visits form/page will be big.. and here comes my question, is this ok? these data of visits table can exceed 40 or 50 fields or do you guys advise different approach?

Thanks for your help in advanced

Have_did_this_during_the_visit (DropDown).

for this you need one table this table will have pk anf fk on visits table's primary key

psychological_reaction (checkboxes) 5 was_wearing_well (yes not selectbox)

for this you need one table this table will have pk anf fk on visits table's primary key

TABLE2: VISITS

    visit_id
    studnet_id (referring and pulling student info from TABLE1)
    date_of_visit
    have_did_this_during_the_visit (DropDown)
    psychological_reaction (checkboxes) 5 was_wearing_well (yes not selectbox)

have_did_this_during_the_visit

id
visit_id
you DropDown vaues

psychological_reaction

id
visit_id
you checkboxes vaues

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM