学校网站SQL设计 [英] School Site SQL Design

查看:171
本文介绍了学校网站SQL设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是递了一个项目,修改学校网站类注册。目前的系统是专门为每个类运行,每周一次,但我需要改变的东西,这样一类可以发生在每周一晚或以上。我挣扎着找到一个有效的方法来涉及各个类别,并允许用户查看并选择一个类注册该系列的时候。

I was just handed a project to modify a school site for class registration. The current system is designed for each class to run one time per week, but I need to change things so that a class can occur on one or more nights per week. I am struggling with finding an efficient method to relate each of the classes, and allow the customers to view and select a single class when registering for the series.

我首先想到的是添加另一个字段(组ID),可容纳一个独特的价值,以配合相应的类在一起。综观查询此方法来排序是困难的,因为如果我排序日的星期之后组ID(用于显示,选课等),那么类将被分离出来。通过组ID,然后排序日的一周产生非时间顺序排列,这也不管用。有没有一种方法来移动类一起排序后组识别符号,但不影响排序的日期?

My first thought is to add another field (groupid) that can hold a unique value to tie corresponding classes together. Looking at queries to sort this method is difficult, because if I sort by day-of-week followed by groupid (for display, class selection, etc), then the classes will be separated. Sorting by groupid then day-of-week produces a non-chronological order, which doesn't work either. Is there a way to move the classes together groupid after sorting, but not affect the sorted date?

我的第二个想法是修改表中每行支持多类。这将是比较容易的方法,但不灵活,并且甚至更成问题,如果类在周的同时不运行

My second thought was to modify the table to support multiple classes per row. This would be the easier method, but less flexible, and even more problematic if the classes don't run at the same time of the week.

不管怎样,我有点失落,并且将AP preciate设计任何反馈,和/或查询来帮助我排序的问题。

Anyway, I'm a little lost, and would appreciate any feedback on design, and/or a query to help with my sort problem.

谢谢!

推荐答案

一个类是一个单一的实体,无论多少天它符合给定的一周。创建一个日程安排表。这将包括一个FK_ClassID和ScheduleDate。如果符合三天一个星期,这将有三个记录。通过这种方式,学生可以安排多种类型,但检查,以确保他们不会过分圈在每周的同一天。

A class is a single entity regardless of how many days it meets in a given week. Create a Schedule table. It would include a FK_ClassID and ScheduleDate. If it meets three days in a week, it would have three records. This way, a student could schedule multiple classes, but check to make sure they do not over-lap on the same day of the week.

这篇关于学校网站SQL设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆