duanchuonong5370 2013-01-08 04:21
浏览 68
已采纳

最佳数据库存储方法

My software (written in PHP) allows users to use an HTML form to enter information for their 'Resume'. There are several different elements of this 'resume' including the user's education, work history, awards, cover letter, and etc. Each element is unique in the data it contains. For example, education requires fields such as graduation year, school name, degree, etc.

My question is, what would be the best approach to store the resume data in a mySQL database? My current choices are:

  • Create individual tables for each resume element (resume_education, resume_awards, etc.)
  • Use a single table for all elements of the resume and insert the element data in the form of multi-dimensional arrays. (IE: one table that holds resume data with columns such as education, workhistory, blah blah. Data in education or similar field would be compiled into an array such as ("grad_year"=>"1990", "school_name"=>"Cool School") or something similar where the usage of indicating characters denotes a new field).

The first choice offers an ease of maintenance and coding whereas the second choice would seem to offer a substantial decrease in backup and maybe load times, and database maintenance. Maybe there is an altogether better approach? What would you recommend ?

  • 写回答

3条回答 默认 最新

  • dqdjfb2325 2013-01-08 04:38
    关注

    I'd go for multiple tables, but not named tables something more generic.

    Eg. tables

    resume_section
    id,name
    1,personal details
    2,education
    3,work history
    
    resume_section_attributes
    id,resume_section_id,name
    1,1,name
    2,1,phone
    3,1,email
    4,2,school_name
    5,2,grad_year
    6,3,company_name
    7,3,number_of_years
    
    user_resume
    id,user_id,resume_section_attribute_id,value
    1,99,1,My Name
    2,99,2,12345678
    

    Now when you want to build a users resume you can go straight to the user resume table and get all their details and join with the attributes table for the attribute names etc. You could change the order of attrs for display, easily add new ones. Set them as required or not. Set limits for the number of phone numbers or something. The possibilities for extending are endless.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等