阈值 SQL Table

Threshold SQL Table

我有一个 GUI 的屏幕截图,需要将其制作成 SQL table。解决此问题的最佳方法是什么?

该屏幕截图中有 3 个不同的实体,因此定义 3 个表。

Create Table ProbabilityThresholds(
  Name varchar (50),
  MinValue int,
  MaxValue int
)

Create Table RisksMatrix (
  Probability varchar(50),
  MinorSeverity varchar(50),
  ModerateSeverity varchar(50),
  MajorSeverity varchar(50),
  ExtremeSeverity varchar(50),
  SortOrder int
 )

Create Table RiskToCategory (
  Risk varchar(50),
  Category varchar(50),
  SortOrder int
)

然后查询多个结果集中的 3 个表(作为 3 个直接查询或作为存储过程)。 as表达式设置了一个列别名,SortOrder列被填充以按需要的布局排序,但在结果中没有被选中:

Select Name
, MinValue
, MaxValue 
from ProbabilityThresholds 
order by MinValue;

Select  
      Probability 
      ,MinorSeverity as "Minor Harm",
      ,ModerateSeverity as "Moderate Harm",
      ,MajorSeverity as "Major Harm",
      ,ExtremeSeverity as "Extreme Harm",
from RisksMatrix  
order by SortOrder ;

Select 
    Risk
   ,Category 
from RiskToCategory 
order by SortOrder;