想要不同时隙的表设计(规范化) [英] Want table design for different time slots(Normalization)

查看:143
本文介绍了想要不同时隙的表设计(规范化)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何规范化

对于每个星期,我们最多可以定义3个时隙,类别ID指定不同的类别.对于每个类别,我们必须定义每周3个时隙.


How to normalize it

For each week no we can define maximum 3 time slots, Category id specifies different categories.For each category we have to define 3 times slots for each week.


Category Id Week No Start Time  End Time
1   1   9:00    1:00
1   1   3:00    5:10
1   1   6:00    7:00
1   2   9:00    1:00
1   2   4:00    5:10
1   2   6:00    7:00
    .
    .
    .
2   1   9:00    1:00
2   1   3:00    5:10
2   1   6:00    7:00
2   2   9:00    1:00
2   2   .   .

推荐答案

我可能会创建一个与您的帖子类似的表,但会添加一个时隙号作为列.与周编号和类别编号结合使用时,该时间段将是唯一的.时隙还具有一个检查约束,该约束值在1到3之间.
I probably would create a table similar to your post but add a timeslot number as a column. The timeslot would be unique when combined with week number and category number. Timeslot would also have a check constraint that the value is between 1 and 3.


这篇关于想要不同时隙的表设计(规范化)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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