我有以下SQL表来保存People度量:
create table dbo.[State] (
Id int identity not null constraint primary key clustered (Id),
UserId int not null,
Created datetime not null
ChestPerimeter decimal (10, 2) null,
HipsPerimeter decimal (10, 2) null,
Weight decimal (10, 2) null
// Other measures
)
有时候我会记录一个小节,有时候会记录一些小节,而其他小节都是。
我是否应该拥有此表或两个表,如下所示:
create table dbo.Measure (
Id int identity not null constraint primary key clustered (Id),
UserId int not null,
MeasureTypeId int not null,
Created datetime not null
Value decimal (10, 2) null,
)
create table dbo.MeasureType (
Id int identity not null constraint primary key clustered (Id),
Name nvarchar(20)
)
测量类型是ChestPerimeter,Weight等等......
或者也许其他选项如MeasureType中的非int PK?
我会将其连接到API以记录这些值。