SQL Engine Reference (v11)

数値関数

数値関数は、decimal 値や integer 値のような数値情報だけから成る列の処理および操作に使用されます。

表 56 数値関数
関数
説明
ABS (numeric_exp)
numeric_exp の絶対値(正数)を返します。
ACOS (float_exp)
ラジアンで示された角度として、float_exp のアークコサインを返します。
ASIN (float_exp)
ラジアンで示された角度として、float_exp のアークサインを返します。
ATAN (float_exp)
ラジアンで示された角度として、float_exp のアークタンジェントを返します。
ATAN2 (float_exp1, float_exp2)
ラジアンで示された角度として、x(float_exp1)座標と y(float_exp2)座標のアークタンジェントを返します。
CEILING (numeric_exp)
numeric_exp で示された値以上の最小の整数を返します。
COS (float_exp)
float_exp がラジアンで示された角度である場合、float_exp のコサインを返します。
COT (float_exp)
float_exp がラジアンで示された角度である場合、float_exp のコタンジェントを返します。
DEGREES (numeric_exp)
numeric_exp のラジアンから変換された度数を返します。
EXP (float_exp)
float_exp の指数値を返します。
FLOOR (numeric_exp)
numeric_exp で示された値以下の最大の整数を返します。
LOG (float_exp)
float_exp の自然対数を返します。
LOG10 (float_exp)
float_exp の 10 を底とする対数を返します。
MOD (integer_exp1, integer_exp2)
integer_exp1integer_exp2 で割った余り(絶対値)を返します。
PI ( )
π の定数値を浮動小数点値で返します。
POWER (numeric_exp, integer_exp)
numeric_expinteger_exp で示されたべき乗を行った値を返します。
RADIANS (numeric_exp)
numeric_exp の度数から変換されたラジアン値を返します。
RAND (integer_exp)
integer_exp をオプションのシード値として使用する、ランダムな浮動小数点値を返します。
ROUND (numeric_exp, integer_exp)
小数点の右側の integer_exp で示される位置で丸められた numeric_exp を返します。integer_exp が負数の場合、numeric_exp は、小数点の左側の |integer_exp|(integer_exp の絶対値)で示される位置で丸められます。
SIGN (numeric_exp)
numeric_exp の符号を示す値を返します。numeric_exp が 0 より小さい場合は -1 が返されます。numeric_exp が 0 の場合は 0 が返されます。numeric_exp が 0 より大きい場合は 1 が返されます。
SIN (float_exp)
float_exp がラジアンで示された角度である場合、float_exp のサインを返します。
SQRT (float_exp)
float_exp の平方根を返します。
TAN (float_exp)
float_exp がラジアンで示された角度である場合、float_exp のタンジェントを返します。
TRUNCATE (numeric_exp, integer_exp)
小数点の右側の integer_exp で示される位置で切り捨てられた numeric_exp を返します。integer_exp が負数の場合、numeric_exp は、小数点の左側の |integer_exp|(絶対値)で示される位置で切り捨てられます。

次の例では、Room テーブルの部屋番号の列と収容人数の列の MOD を一覧表示します。

SELECT Number, Capacity, MOD(Number, Capacity)  FROM Room WHERE Building_Name = 'Faske 
Building' and Type = 'Classroom' 
666

次の例では、Faculty テーブルから 100 で割り切れる給与すべてを選択します。

SELECT Salary FROM Faculty WHERE MOD(Salary, 100) = 0 

文字列関数

時刻と日付の関数