日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

sql算术运算符_SQL中的算术运算符

發布時間:2025/3/11 数据库 17 豆豆
生活随笔 收集整理的這篇文章主要介紹了 sql算术运算符_SQL中的算术运算符 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

sql算術運算符

SQL | 算術運算符 (SQL | Arithmetic Operators)

Different number-crunching administrators are utilized in SQL to be specific Addition (+), Subtraction (-), Multiplication (*), Division (/), Modulus (%).

SQL中使用了不同的數字運算管理員來表示特定的加法(+),減法(-),乘法(*),除法(/),模數(%)

For the further examples we will be referring to the following base table:

對于其他示例,我們將參考以下基礎表:

Table: BOOKS

表:書

BookNoNameCostDiscount
9871Nancy Drew2005%
9560Goosebump25010%
9810Sherlock Holmes30015%
8700The Blue Umbrella2006%
5086Gulliver Travels1604%
1272Hellen Keller1504%
書號 名稱 成本 折扣
9871 南希·德魯 200 5%
9560 雞皮ump 250 10%
9810 夏洛克·福爾摩斯 300 15%
8700 藍傘 200 6%
5086 格列佛游記 160 4%
1272 海倫·凱勒 150 4%

1)加法(+) (1) Addition (+))

It is utilized to perform addition procedures on the information things, things incorporate either single section or different segments.

它用于對信息事物執行附加過程,這些事物包含單個部分或不同的段。

Implementation:

實現方式:

SELECT bookno, name, cost, discount, cost+50 AS "Final Cost" FROM BOOKS;

Output

輸出量

BookNoNameCostDiscountFinal Cost
9871Nancy Drew2005%250
9560Goosebump25010%300
9810Sherlock Holmes30015%350
8700The Blue Umbrella2006%250
5086Gulliver Travels1604%210
1272Hellen Keller1504%200
書號 名稱 成本 折扣 最終成本
9871 南希·德魯 200 5% 250
9560 雞皮ump 250 10% 300
9810 夏洛克·福爾摩斯 300 15% 350
8700 藍傘 200 6% 250
5086 格列佛游記 160 4% 210
1272 海倫·凱勒 150 4% 200

Similarly, we can do the addition of two columns too.

同樣,我們也可以添加兩列。

2)減法(-) (2) Subtraction (-))

It is utilized to perform subtraction procedures on the information things, things incorporate either a single section or different segments.

它用于對信息事物執行減法過程,信息包含單個部分或不同的段。

Implementation:

實現方式:

SELECT bookno, name, cost, discount, cost-discount AS "Final Cost" FROM BOOKS;

Output

輸出量

BookNoNameCostDiscountFinal Cost
9871Nancy Drew20012.50237.50
9560Goosebump25030.00270.00
9810Sherlock Holmes30052.50297.50
8700The Blue Umbrella20015.00235.00
5086Gulliver Travels1608.40201.6
1272Hellen Keller1508.00192.00
書號 名稱 成本 折扣 最終成本
9871 南希·德魯 200 12.50 237.50
9560 雞皮ump 250 30.00 270.00
9810 夏洛克·福爾摩斯 300 52.50 297.50
8700 藍傘 200 15.00 235.00
5086 格列佛游記 160 8.40 201.6
1272 海倫·凱勒 150 8.00 192.00

3)乘法(*) (3) Multiplication (*))

It is utilized to perform multiplication procedures on the information things, things incorporate either a single section or different segments.

它用于對信息事物執行乘法過程,這些事物包含單個節或不同段。

Implementation:

實現方式:

SELECT bookno, name, cost, discount, cost*discount AS "Final Cost" FROM BOOKS;

Output

輸出量

BookNoNameCostDiscountFinal Cost
9871Nancy Drew20012.50?2500?
9560Goosebump25030.007500
9810Sherlock Holmes30052.5015750
8700The Blue Umbrella20015.003000
5086Gulliver Travels1608.401344
1272Hellen Keller1508.001200
書號 名稱 成本 折扣 最終成本
9871 南希·德魯 200 12.50 ?2500?
9560 雞皮ump 250 30.00 7500
9810 夏洛克·福爾摩斯 300 52.50 15750
8700 藍傘 200 15.00 3000
5086 格列佛游記 160 8.40 1344
1272 海倫·凱勒 150 8.00 1200

4)師(/) (4) Division (/))

It is utilized to perform division procedures on the information things, things incorporate either a single section or different segments.

它用于對信息事物執行劃分過程,信息包含單個部分或不同的段。

Implementation:

實現方式:

SELECT bookno, name, cost, discount, cost/discount AS "Final Cost" FROM BOOKS;

Output

輸出量

BookNoNameCostDiscountFinal Cost
9871Nancy Drew20012.50?16.00?
9560Goosebump25030.008.33
9810Sherlock Holmes30052.505.71
8700The Blue Umbrella20015.0013.33
5086Gulliver Travels1608.4019.04
1272Hellen Keller1508.0018.75
書號 名稱 成本 折扣 最終成本
9871 南希·德魯 200 12.50 ?16.00?
9560 雞皮ump 250 30.00 8.33
9810 夏洛克·福爾摩斯 300 52.50 5.71
8700 藍傘 200 15.00 13.33
5086 格列佛游記 160 8.40 19.04
1272 海倫·凱勒 150 8.00 18.75

5)模量(%) (5) Modulus (%))

This operator is used to get the remainder when the division operation is performed with the data.

當對數據執行除法運算時,該運算符用于獲取余數。

Implementation:

實現方式:

SELECT bookno, name, cost, discount, cost%discount AS "Final Cost" FROM BOOKS;

Output

輸出量

BookNoNameCostDiscountFinal Cost
9871Nancy Drew20012.50?0?
9560Goosebump25030.0010
9810Sherlock Holmes30052.5037.5
8700The Blue Umbrella20015.005
5086Gulliver Travels1608.400.4
1272Hellen Keller1508.006
書號 名稱 成本 折扣 最終成本
9871 南希·德魯 200 12.50 ?0?
9560 雞皮ump 250 30.00 10
9810 夏洛克·福爾摩斯 300 52.50 37.5
8700 藍傘 200 15.00 5
5086 格列佛游記 160 8.40 0.4
1272 海倫·凱勒 150 8.00 6

翻譯自: https://www.includehelp.com/sql/arithmetic-operators.aspx

sql算術運算符

總結

以上是生活随笔為你收集整理的sql算术运算符_SQL中的算术运算符的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。