Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql表定义存储范围和相应折扣_Mysql_Database_Range - Fatal编程技术网

Mysql表定义存储范围和相应折扣

Mysql表定义存储范围和相应折扣,mysql,database,range,Mysql,Database,Range,如何在MySQL中设计/创建一个表,存储根据购买金额给出的购买范围和折扣 例如,范围如下所示: 10% for purchase of 0-1000 20% for 1001-2000 30% for 2001-3000 & 40% for 3000+ (anything more than 3000) 我可以保存前3个范围,如下所示, 但最后一个范围的最大值应该是多少 min max discount ----------------------------

如何在MySQL中设计/创建一个表,存储根据购买金额给出的购买范围和折扣

例如,范围如下所示:

10% for purchase of 0-1000

20% for 1001-2000

30% for 2001-3000

&

40% for 3000+ (anything more than 3000)
我可以保存前3个范围,如下所示, 但最后一个范围的最大值应该是多少

min      max     discount
-------------------------------
   0     1000    10%
1001     2000    20%
2001     3000    30%
3000+       ?    40%

或者任何其他方式?

NULL
都可以。那么可以使用什么查询来搜索范围内的值?可以使用列定义的最大值。