doushantun0614 2015-04-08 17:42
浏览 21
已采纳

在数据库中存储考试数据的最佳方法[关闭]

I am looking to implement a new database and store students exam data and marks in the database. There are an arbitrary number of students and each student has an arbitrary number of modules with corresponding marks. I need the database to be created so that I am able to query the database and return the students name followed by each of their modules and corresponding marks and then to move onto the next student. This is because I want to display it in PHP with a list of students names in bold and then a table of their modules and their marks.

I initially considered to organise the table like this:

| StudentName | Module | Result |

With a new entry for each module that the student takes and just store multiple students but then I do not know how I would then query the database and retrieve each StudentName individually and then be able to loop through their corresponding modules and results to store it in an HTML table.

Any ideas would be appreciated

  • 写回答

2条回答 默认 最新

  • duankuixi1930 2015-04-08 17:47
    关注
    • Give each table an id field that auto increments
    • Where you need to link results to modules, for example, you'd add a moduleID field to the result table to tie the result to the module. You'd then do queries with joins to bring in both sets of data.
    • To tie students to modules, you'd need another table that has a studentID field and a ModuleID field. You'd then query this table and join on StudentName and Module to get the respective data for each.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器