SQL Function: ABS()

Definition:

Return the absolute value of data.

(Remark:ABS/ABSOLUTE() with the same function is provided in HKDSE ICT candidates’ reference sheet.)


Command Example:

Table STUDENT_RESULT
SID SNAME CLASS CNO MARK
010122 Chris Wong 1A 5 19.4
010142 Nico Lin 1C 7 34.8
010133 Amy Chan 2D 12 -97.5

Input:
SELECT SID,ABS(MARK) AS MARK FROM STUDENT_RESULT;

Output:
SID MARK
010122 19.4
010142 34.8
010133 97.5


‘Absolutely negative.’By secondary 6 student

Comments