SQL Value Functions

Part of the SQL All-in-One Cheat Sheet

You use SQL value expressions to combine two or more values. Several kinds of SQL value expressions exist, corresponding to the different data types; the following table lists string, numeric and datetime values, functions, and effects:

SQL Value Functions
String Value Functions Effect
SUBSTRING Extracts a substring from a source string
UPPER Converts a character string to all uppercase
LOWER Converts a character string to all lowercase
TRIM Trims off leading or trailing blanks
TRANSLATE Transforms a source string from one character set to another
CONVERT Transforms a source string from one character set to another
Numeric Value Functions Effect
POSITION Returns the starting position of a target string within a source string
CHARACTER_LENGTH Returns the number of characters in a string
OCTET_LENGTH Returns the number of octets (bytes) in a character string
EXTRACT Extracts a single field from a datetime or interval
Datetime Value Functions Effect
CURRENT_DATE Returns the current date
CURRENT_TIME(p) Returns the current time; (p) is precision of seconds
CURRENT_TIMESTAMP(p) Returns the current date and the current time; (p) is precision of seconds

Comments (0)

Leave a Reply


Post Comment

SERIES
SQL All-in-One Cheat Sheet

Grab a free widget and we'll bring interesting & helpful tips to your favorite personal page each day

Sign Up for RSS Feeds

Computers & Software

Inside Dummies.com