[英]Database table design task
有一个拥有15条生产线的工厂。 每条生产线每天都有自己的表格,需要每小时填写一次效率度量。 表由列(时间段)和带有子类别的类别组成,这使它大约有80行。 这是一个例子:
您能给我有关数据库设计的任何建议吗?
要求:
服务器需要快速获取特定日期的所有表数据。 服务器需要快速检索特定的单元格(按行号,日期,时间段和子类别)。
create table metric
( -- a thing to track
metricNum int auto_increment primary key, -- 1,2,3 etc
metricName varchar(200) -- ie: "Splat & spild", etc
);
create table efficiency
( -- all data for all lines for all time
id int auto_increment primary key,
lineNum int not null,
theDate day not null,
metricNum int not null,
theHour int not null,
theCount int not null
-- add indexes of use
-- add foreign key (FK) constraint(s), such as to metric
);
而已。 两张桌子。 并非每一行每天都有一个新表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.