mysql - 选课系统数据库课程数据表的设计?
高洛峰
高洛峰 2017-04-17 16:46:49
0
1
634

大概就是一个选课系统的网站,其中要实现学生选课的功能,一般课程的时间都是周X 第X节到第X节,然后我就不知道数据表里面的time字段该怎么搞了。。。


感觉放date类型也不对,放string类型也很怪,而且还要展示学生的课表,到时候肯定还是按时间来展示的。。所以求指点这个字段该怎么设计?

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

reply all(1)
刘奇

You can separate courses, students, schedules, and course selection relationships into four separate tables.

课程表
    课程ID
    课程名称
    讲师姓名
    第几周到第几周
    ...
学生
    学生ID
    学生姓名
    ...
日程表
    日程ID
    课程ID
    星期几
    第几节课
    ...
选课关系
    选课关系ID
    学生ID
    课程ID

Now that you know the name of the student, if you want to search for those classes that you will take tomorrow afternoon, just do this:
Get the student ID based on the name from the student table, and get the course IDs of all the courses he has chosen based on the student ID from the course selection relationship, from The course schedule gets the start and end time of each course based on the course ID, keeping those courses that match tomorrow's date. Then get the courses that may be taken tomorrow afternoon from the schedule based on the course ID.
That’s about it, I think. I've never done anything like this, so I just made a guess. Hope that helps.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!