Oracle 如何构造一个db表来存储像0这样的范围;20;40;60;80或0;50;100;150;200;250;... 等等

Oracle 如何构造一个db表来存储像0这样的范围;20;40;60;80或0;50;100;150;200;250;... 等等,oracle,database-design,relational-database,database-schema,Oracle,Database Design,Relational Database,Database Schema,我想将下面的范围存储在一个表中,template01中的项数是6,second是4。我们如何构造表来存储这些信息。我的最后一个选择是将这些值显示为逗号分隔的值,或者为每个范围值指定一列。您能否帮助我们构建表格以存储以下信息 Template01 0 10 20 30 40 50 Template02 0 50 100 150 Template03 0 100

我想将下面的范围存储在一个表中,template01中的项数是6,second是4。我们如何构造表来存储这些信息。我的最后一个选择是将这些值显示为逗号分隔的值,或者为每个范围值指定一列。您能否帮助我们构建表格以存储以下信息

Template01      0      10       20         30      40       50
Template02      0      50      100        150
Template03      0     100      200        300     400      500      600 
基本上,我想将这些范围存储为模板,然后用它来表示如果行李重量在0-10之间,每千克成本为5美元,如果是10-20,每千克成本为4.8美元等等

这就是模板的使用方式

Domain: XYZ
Template01      0      10       20         30      40       50
Increment01%   125%    120%      115%       110%    105%    100%

Domain: ABC, am using or picking the same template 'Template01' but Increment% 
will be different for different domain, hence

Template01      0      10       20         30      40       50
Increment02%   150%    140%      130%       120%    110%    100%
我的想法是,我想存储体重减轻的模板,然后我想关联不同的增量%。因此,当用户选择权重打断模板时,可显示适用于或配置用于该模板的所有增量%值,供用户选择

Template01      0      10       20         30      40       50
Increment01%   125%    120%      115%       110%    105%    100%  [Choice 1]
Increment02%   150%    140%      130%       120%    110%    100%  [Choice 2]

标准方法是:

Template_Name  Weight_From  Weight_To  Price
-------------  -----------  ---------  -----
Template01     0            10         5
Template01     10           20         4.8
...
Template01     40           50         ...
Template01     50           (null)     ...
Template02     0            50         ...
...
Template03     500          600        ...
Template03     600          (null)     ...

标准方法是:

Template_Name  Weight_From  Weight_To  Price
-------------  -----------  ---------  -----
Template01     0            10         5
Template01     10           20         4.8
...
Template01     40           50         ...
Template01     50           (null)     ...
Template02     0            50         ...
...
Template03     500          600        ...
Template03     600          (null)     ...

对于规范化模式,需要有模板、增量、模板权重和增量因子的表

 create table luggage_weight_template (
   luggage_weight_template_id number primary key,
   template_name varchar2(100) unique);


 create table luggage_increment (
   luggage_increment_id number primary key,
   increment_name varchar2(100), 
   luggage_weight_template_id  references luggage_weight_template(luggage_weight_template_id)); 


 create table template_weight (
   template_weight_id number primary key,
   luggage_weight_template_id references luggage_weight_template(luggage_weight_template_id),
   weight_from  number not null);


 create table increment_factor (
   increment_factor number primary key,
   increment_id references luggage_increment(luggage_increment_id),
   template_weight_id references template_weight(template_weight_id));

对于规范化模式,需要有模板、增量、模板权重和增量因子的表

 create table luggage_weight_template (
   luggage_weight_template_id number primary key,
   template_name varchar2(100) unique);


 create table luggage_increment (
   luggage_increment_id number primary key,
   increment_name varchar2(100), 
   luggage_weight_template_id  references luggage_weight_template(luggage_weight_template_id)); 


 create table template_weight (
   template_weight_id number primary key,
   luggage_weight_template_id references luggage_weight_template(luggage_weight_template_id),
   weight_from  number not null);


 create table increment_factor (
   increment_factor number primary key,
   increment_id references luggage_increment(luggage_increment_id),
   template_weight_id references template_weight(template_weight_id));

好建议。更新了我的问题,阅读更新后让我知道你的想法。好建议。更新了我的问题,请在阅读更新后告诉我您的想法。感谢表格,我为当前场景优化了一点,并使用了itThanks作为表格,我为当前场景优化了一点,并使用了它