基于northwind数据库的sql查询计算taxamount和taxrate [英] Sql query calculating taxamount and taxrate based on northwind database
问题描述
要有礼貌。这里的每个人都有帮助,因为他们喜欢帮助,而不是因为这是他们的工作。
您是否搜索过Google或使用Google搜索解决方案?
具体!例如如何更改对话框颜色?而不是我的代码不起作用。帮助?
适当标记你的问题。
如果你有学校或大学的任务,假设你的老师或讲师是也阅读这些论坛。
我尝试过:
已解决
Be courteous. Everyone here helps because they enjoy helping, not because it's their job.
Have you searched or Googled for a solution?
Be specific! eg "How do I change the dialog colour?" instead of "My code doesn't work. Help?"
Tag your question appropriately.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
What I have tried:
Resolved
推荐答案
似乎你不理解你的老师。您必须创建两个用户定义函数(UDF) [ ^ ]。
Seems you don't understand your teacher. You have to create two User Defined Functions (UDF)[^].
1. TaxRate UDF 根据ShipCountry提供税率并返回FLOAT值。
如果ShipCountry以范围内的字母开头
AJ税率为.04
KP税率为.03
QZ税率为.025
2. TaxAmount UDF 提供到期税。它需要两个值,SalesAmount和TaxRate。 SalesAmount属于MONEY数据类型,TaxRate属于FLOAT数据类型。 UDF返回一个MONEY值。
1. The TaxRate UDF provides the tax rate based on a ShipCountry and returns a FLOAT value.
If the ShipCountry starts with a letter in the range
A-J the tax rate is .04
K-P the tax rate is .03
Q-Z the tax rate is .025
2. The TaxAmount UDF provides the tax due. It takes two values, a SalesAmount and a TaxRate. The SalesAmount is of the MONEY data type and the TaxRate is of the FLOAT data type. The UDF returns a MONEY value.
最后,你必须提供一个使用该2 UDF的查询。
按照我提供的链接了解如何创建UDF。
Finally, you have to provide a query which uses that 2 UDF's.
Follow the link i provided to find out how to create UDF.
这篇关于基于northwind数据库的sql查询计算taxamount和taxrate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!