提交 7ec23737 编写于 作者: M Mars Liu

function and procedure

上级 0c926ee6
{
"type": "code_options",
"author": "Mars Liu",
"author": "ccat",
"source": "subquery.md",
"notebook_enable": false,
"exercise_id": "2fabb69f22224e48a26fec8911798ceb"
......
{
"type": "code_options",
"author": "Mars Liu",
"author": "ccat",
"source": "view.md",
"notebook_enable": false,
"exercise_id": "5335391d25d0428aa3dbe1759ac1ef37"
......
{
"type": "code_options",
"author": "Mars Liu",
"author": "ccat",
"source": "create_view.md",
"notebook_enable": false,
"exercise_id": "990e457f98db463b9fe14831f6ab2afc"
......
{
"type": "code_options",
"author": "Mars Liu",
"author": "ccat",
"source": "alter_view.md",
"notebook_enable": false,
"exercise_id": "a54d8dc829b64c78b63f3480af42e80e"
......
{
"type": "code_options",
"author": "Mars Liu",
"author": "ccat",
"source": "drop_view.md",
"notebook_enable": false,
"exercise_id": "3ef595b611414ae7957ffa93a91a5b99"
......
......@@ -2,7 +2,9 @@
"node_id": "mysql-0666cae9faaa41b7b2413063e1214edd",
"keywords": [],
"children": [],
"export": [],
"export": [
"tax.json"
],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
......
{
"type": "code_options",
"author": "ccat",
"source": "tax.md",
"notebook_enable": false,
"exercise_id": "bc846ce638304b27a51ae20299120b98"
}
\ No newline at end of file
# 个人所得税计算
个人所得税的计算需要进行若干指标的求和,然后基于分段的基数和系数计算得到扣税金额。
因此 Joe 准备用一个存储过程或函数将个人所得税计算封装起来,供团队使用,那么,下列
措施中哪一项是错误的?
## 答案
通过 `create function iitax(amount decimal(12, 4), out tax decimal(12, 4), out rest decimal(12, 4)) `
定义个人所得税计算函数。
## 选项
### A
通过 `create function iitax(amount decimal(12, 4)) returns decimal(12, 4)` 定义个人所得税计算函数。
### B
通过 `create procedure(amount decimal(12, 4), out tax decimal(12, 4), out rest decimal(12, 4))`
定义计算过程,将税金和剩余金额通过 out 参数传递出来。
### C
通过 `select iitax(amount)` 可以调用 iitax 函数得到所得税金额。
### D
通过 `call iitax(amount, @tax, @rest)` 可以求得 amount 对应的个人所得税金额,
并将税额和剩余金额保存在 `@tax``@rest` 变量中。
\ No newline at end of file
{
"type": "code_options",
"author": "Mars Liu",
"author": "ccat",
"source": "DoubleNotExists.md",
"notebook_enable": false,
"exercise_id": "b9381a1d56da4de0862f5a8d3c7bb59a"
......
{
"node_id": "mysql-5e5c02582f1641ada50c92161d0e0587",
"keywords": [],
"children": [],
"export": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
}
\ No newline at end of file
{
"node_id": "mysql-66fc4566eaf34994b072ca83bf79ceb4",
"keywords": [],
"keywords": ["performance", "优化", "group by"],
"children": [],
"export": [],
"keywords_must": [],
......
{
"type": "code_options",
"author": null,
"author": "Mars",
"source": "bulk_insert.md",
"notebook_enable": false,
"exercise_id": "936ee1ecbd4a4b9aa795fa537e24f659"
......
{
"type": "code_options",
"author": null,
"author": "Mars",
"source": "performance_delete.md",
"notebook_enable": false,
"exercise_id": "105bda06ce03418aaad1422b61767cb6"
......
{
"type": "code_options",
"author": null,
"author": "Mars",
"source": "configuration.md",
"notebook_enable": false,
"exercise_id": "b90270843de54822a1556cb47ca49394"
......
{
"type": "code_options",
"author": null,
"author": "Mars",
"source": "performance_delete.md",
"notebook_enable": false,
"exercise_id": "cea8e3db523b4f1fb9a502e1d9c27d7b"
......
{
"type": "code_options",
"author": null,
"author": "Mars",
"source": "sys.md",
"notebook_enable": false,
"exercise_id": "ed53fabf084c4ceb99952f5196412b49"
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册