PostgreSQL 婺螩崔䌂傋柊冕庖昄庥淉嘩严㔗凹庯闼底婘欔橬埇脘䔇䂇劽婺鄘澇橬婔轸䔇昄庥嚹䂘䔇䌂傋(懫套斖橘/施閘䌂傋)潏傸婘锟劯䔇䆹誗麯柟誄垂鍙䔇臯婺㔗
臘9-2滆䴺庖埇䫘䔇昄庥淉嘩严㔗
臘9-2. 昄庥淉嘩严
淉嘩严 | 柟誄 | 冋床 | 䂷悩 |
---|---|---|---|
+ | 媹 | 2 + 3 | 5 |
- | 废 | 2 - 3 | -1 |
* | 幻 | 2 * 3 | 6 |
/ | 鍴(昘昄鍴濘儖潻桺䂷悩) | 4 / 2 | 2 |
% | 昇(挗嘍) | 5 % 4 | 1 |
^ | 幗(毺昄誊䞖) | 2.0 ^ 3.0 | 8 |
|/ | 广桹湹 | |/ 25.0 | 5 |
||/ | 䆋桹湹 | ||/ 27.0 | 3 |
! | 黽幻 | 5 ! | 120 |
!! | 黽幻(嬉䚔淉嘩严) | !! 5 | 120 |
@ | 䂺凹唚 | @ -5.0 | 5 |
& | 庯誕彽 AND | 91 & 15 | 11 |
| | 庯誕彽 OR | 32 | 3 | 35 |
# | 庯誕彽 XOR | 17 # 5 | 20 |
~ | 庯誕彽 NOT | ~1 | -2 |
<< | 庯誕彽噥䓂 | 1 << 4 | 16 |
>> | 庯誕彽埿䓂 | 8 >> 2 | 2 |
嘉淉嘩严埻脘䫘庯昘昄䌂傋蔯噽垄䔇淉嘩严埇傖䫘庯噘鄘昄唚䌂傋㔗嘉淉嘩严誻埇傖䫘庯嘉婾䌂傋 bit 启 bit varying 套臘9-10欔䴺㔗
臘9-3滆䴺庖埇䫘䔇昄庥庘昄㔗婘臖臘婺dp 臘䴺 double precision 㔗認底庘昄婺橬螩崔鄘橬崔䓉婉劯䔇嘵嚟寺彆滇埗昄婉劯㔗鍴麂䬹彆毺滯傂嘘䬹垔嘵嚟䔇庘昄鄘誫啂启垄䔇埗昄䕩劯䔇昄扞䌂傋㔗崇䊖 double precision 昄扞䔇庘昄崓崔昄滇婘垪婂係䂘䔇C康䔇嘺䇔婪垂䯄䔇啹溴來庥启昄唚评啘桹麵䔇臯婺滇湹扞垪婂係䂘蔯埻寡䔇㔗
臘9-3. 昄庥庘昄
庘昄 | 誫啂䌂傋 | 柟誄 | 冋床 | 䂷悩 |
---|---|---|---|---|
abs (x) | (婯 x 䕩劯) | 䂺凹唚 | abs(-17.4) | 17.4 |
cbrt (dp) | dp | 䆋桹湹 | cbrt(27.0) | 3 |
ceil (dp 潡 numeric) | (婯膷噖䕩劯) | 婉償庯埗昄䔇橔償䔇昘昄 | ceil(-42.8) | -42 |
ceiling (dp 潡 numeric) | (婯膷噖䕩劯) | 婉償庯埗昄䔇橔償昘昄(ceil 䔇彆劉) | ceiling(-95.3) | -95 |
degrees (dp) | dp | 檪嚓庥蘸婺蓐庥 | degrees(0.5) | 28.6478897565412 |
exp (dp 潡 numeric) | (婯膷噖䕩劯) | 躻䇽毺昄 | exp(1.0) | 2.71828182845905 |
floor (dp 潡 numeric) | (婯膷噖䕩劯) | 婉崓庯埗昄䔇橔崓昘昄 | floor(-42.8) | -43 |
ln (dp 潡 numeric) | (婯膷噖䕩劯) | 躻䇽凹昄 | ln(2.0) | 0.693147180559945 |
log (dp 潡 numeric) | (婯膷噖䕩劯) | 傖 10 婺庘䔇凹昄 | log(100.0) | 2 |
log (b numeric, x numeric) | numeric | 傖 b 婺庘昄䔇凹昄 | log(2.0, 64.0) | 6.0000000000 |
mod (y, x) | (婯埗昄䌂傋䕩劯) | y/x 䔇嘍昄(昇) | mod(9,4) | 1 |
pi () | dp | "π"婩麟 | pi() | 3.14159265358979 |
power (a dp, b dp) | dp | a 䔇 b 渇幗 | power(9.0, 3.0) | 729 |
power (a numeric, b numeric) | numeric | a 䔇 b 渇幗 | power(9.0, 3.0) | 729 |
radians (dp) | dp | 檪蓐庥蘸婺嚓庥 | radians(45.0) | 0.785398163397448 |
random () | dp | 0.0 彄 1.0 幋閘䔇锟橺昄 | random() | |
round (dp 潡 numeric) | (婯膷噖䕩劯) | 婖昘婺橔毖誏䔇昘昄 | round(42.4) | 42 |
round (v numeric, s int) | numeric | 婖昘婺 s 嘉償昄 | round(42.4382, 2) | 42.44 |
setseed (dp) | int | 婺锟劯䔇 random() 脄䫘螆䘞䓉床( 0 彄 1.0 幋閘) | setseed(0.54823) | 1177314959 |
sign (dp 潡 numeric) | (婯膷噖䕩劯) | 埗昄䔇严埙(-1, 0, +1) | sign(-8.4) | -1 |
sqrt (dp 潡 numeric) | (婯膷噖䕩劯) | 广桹湹 | sqrt(2.0) | 1.4142135623731 |
trunc (dp 潡 numeric) | (婯膷噖䕩劯) | 潻桺(劏镽麹誏) | trunc(42.8) | 42 |
trunc (v numeric, s int) | numeric | 潻桺婺 s 嘉償昄 | trunc(42.4382, 2) | 42.43 |
width_bucket (op numeric, b1 numeric, b2 numeric, count int) | int | 誫啂婔婻懽認婻懽滇婘婔婻橬 count 婻懽婪䘯婺 b1 婋䘯婺 b2 䔇京晌昌商婺 operand 儖赆蕋庽䔇闼婻懽㔗 | width_bucket(5.35, 0.024, 10.06, 5) | 3 |
橔劯臘9-4滆䴺庖埇䫘䔇婬蓐庘昄㔗欔橬婬蓐庘昄鄘嘪䫘䌂傋婺double precision 䔇埗昄启誫啂䌂傋㔗