我有以下结构,我想将其转换为表(RDBMS)。
1)
Structure(
// 1st entry
"HK"
Structure(
"Aggressive Price", 100
"Passive Price", 90,
"Quantity", 1000
"Tick Ladder", [ [ 0.1, 1 ],
[ 0.2, 2 ],
[ 0.3, 3 ]
]
),
//2nd entry
"JP",
Structure(
"Aggressive Price", 100
"Passive Price", 90,
"Quantity", 1000
"Tick Ladder", [ [ 0.1, 1 ],
[ 0.2, 2 ],
[ 0.3, 3 ]
],
Aggressive limits, Structure( "ABC", 10, "SCD", 20 )
)
)
2)
Structure(
// 1st entry
"Algo1"
Structure(
"Aggressive Price", 100
"Passive Price", 90,
"Quantity", 1000
"Tick Ladder", [ [ 0.1, 1 ],
[ 0.2, 2 ],
[ 0.3, 3 ]
]
),
//Second entry
"JP",
Structure(
"Aggressive Price", 100
"Passive Price", 90,
"Quantity", 1000
"Tick Ladder", [ [ 0.1, 1 ],
[ 0.2, 2 ],
[ 0.3, 3 ]
],
Aggressive limits, Structure( "ABC", 10, "SCD", 20 )
)
)
Structure(
// 1st entry
"Algo2"
Structure(
"Aggressive Price", 100
"Passive Price", 90,
"Quantity", 1000
"Tick Ladder", [ [ 0.1, 1 ],
[ 0.2, 2 ],
[ 0.3, 3 ]
]
),
//Second entry
"JP",
Structure(
"Aggressive Price", 100
"Passive Price", 90,
"Quantity", 1000
"Tick Ladder", [ [ 0.1, 1 ],
[ 0.2, 2 ],
[ 0.3, 3 ]
],
Aggressive limits, Structure( "ABC", 10, "SCD", 20 )
)
)
1) - 包含国家“HK”& amp;的参数。 “JP”。
2) - 包含“Algo1”和“Algo2”的相同参数。参数的值可以变化。将此表示为关系模式的最佳方式是什么。
解决方案我在考虑
1)具有激进价格,被动价格,数量,刻度梯的表“参数”
2)参考表参数
的表“Country”3)表格“Algo”,它引用表参数
4)用于存储梯形图值的表“Ladder”,它将被“Parameter”数组引用。
如何为引用“参数”等的“国家/地区”表生成唯一键?
还有其他更好的方法吗?
答案 0 :(得分:0)
这样的事情是不是很明显?
create table countries (country_code char(2) primary key,
country longtext);
create table algos (pk char(40) primary key,
country_code_fk char(2),
aggressive_price decimal(8,2),
passive_price decimal(8,2),
quantity int,
tick_ladder enum);
create table aggressive_limits (algo_fk char(40),
field_0 char(3),
field_1 int,
field_2 char(3),
field_3 int);