Professional Documents
Culture Documents
SQL
Single-Row Functions
Function
Input Output
Function
arg 1 performs action Result
value
arg 2
arg n
Function
Single-row Multiple-row
functions functions
Character
General Number
Single-row
functions
Conversion Date
Character
functions
LOWER CONCAT
UPPER SUBSTR
INITCAP LENGTH
INSTR
LPAD | RPAD
Function Result
LOWER('SQL Course') sql course
UPPER('SQL Course') SQL COURSE
INITCAP('SQL Course') Sql Course
Function Result
ROUND(45.926, 2) 45.93
TRUNC(45.926, 2) 45.92
MOD(9, 4) 1
CEIL(22.12) 23
FLOOR(12.95) 12
FORMAT(12332.123456, 4); 12,332.1235
Function Description
NOW Returns the current date
AGE Returns the years and months
EXTRACT Extracts a field from a date
– quantity is a number
– unit is microsecond, millisecond, second,
minute, hour, day, week, month, year,
decade, century…
Datatype
conversion
TO_NUMBER TO_DATE
TO_CHAR TO_CHAR
Element Description
YYYY Full year in numbers
MM Two-digit value for month
MONTH Full name of the month
Three-letter abbreviation of
DY
the day of the week
DAY Full name of the day
Element Description
HH12 or HH24 Hour of day (1-12) or (0-23)
MI Minute (0-59)
SS Seconds (0-59)
9 Represents a number
0 Forces a zero to be displayed
$ Places a floating dollar sign
. Prints a decimal point
, Prints a thousand indicator
SELECT matricule,
to_number(matricule,999999) + 2 as matricule2
FROM etudiant
limit 2;
F3(F2(F1(col,arg1),arg2),arg3)
Step 1 = Result 1
Step 2 = Result 2
Step 3 = Result 3