MySQL Matematik Fonksiyonları
ABS(x) | x’in pozitif degerini bulur |
SIGN(x) | x pozitif ise 1, negatif ise -1, 0 ise 0 degerini uretir |
MOD(x,y) | x y’ye bolunur ve kalan deger fonksiyondan doner |
FLOOR(x) | x’e en yakin ve x’den kucuk tamsayiyi bulur |
CEILING(x) | x’e en yakin ve x’den buyuk tamsayiyi bulur |
ROUND(x) | x’e en yakin tamsayiyi verir |
ROUND(x,D) | noktali sayilarda x’e en yakin, noktadan sonra D rakam olan sayiyi verir. |
POW ( x, y ) | x’in y’ninci kuvvetini bulur |
SQRT ( x ) | x’in karekokunu bulur |
PI ( ) | Pi sayisini verir |
GREATEST ( x, y, z .. ) | en buyuk veriyi bulur |
TRUNCATE ( x, D ) | noktali x sayisini noktadan sonra D rakamli hale sokar |
Örnek
MariaDB [obs]>select floor(-5.2), ceiling(-5.2), round(1.16), round(1.16,1); +-------------+---------------+-------------+---------------+ | floor(-5.2) | ceiling(-5.2) | round(1.16) | round(1.16,1) | +-------------+---------------+-------------+---------------+ | -6 | -5 | 1 | 1.2 | +-------------+---------------+-------------+---------------+ 1 row in set (0.05 sec)
Örnek
MariaDB [obs]>select power(3,3),sqrt(25), truncate(Pi(),1); +------------+----------+------------------+ | power(3,3) | sqrt(25) | truncate(Pi(),1) | +------------+----------+------------------+ | 27.000000 | 5.000000 | 3.1 | +------------+----------+------------------+ 1 row in set (0.05 sec)