19
Chapter 5 Selected Single-Row Functions

Chapter 5 Selected Single-Row Functions. Chapter Objectives Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

Embed Size (px)

Citation preview

Page 1: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

Chapter 5Selected Single-Row

Functions

Chapter 5Selected Single-Row

Functions

Page 2: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

TerminologyTerminology

Function – predefined block of code that accepts arguments– Single-row Function – returns one row of

results for each record processed– Multiple-row Function – returns one result

per group of data processed

Function – predefined block of code that accepts arguments– Single-row Function – returns one row of

results for each record processed– Multiple-row Function – returns one result

per group of data processed

Page 3: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

Types of FunctionsTypes of Functions

Page 4: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

Case Conversion FunctionsCase Conversion Functions

Alter the case of data stored in a column or character stringAlter the case of data stored in a column or character string

Page 5: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

LOWER FunctionLOWER Function

Used to convert characters to lower-case lettersUsed to convert characters to lower-case letters

Page 6: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

UPPER FunctionUPPER Function

Used to convert characters to upper-case lettersUsed to convert characters to upper-case letters

Page 7: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

INITCAP FunctionINITCAP Function

Used to convert characters to mixed-caseUsed to convert characters to mixed-case

Page 8: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

Character Manipulation FunctionsCharacter Manipulation Functions

Manipulates data by extracting substrings, counting number of characters, replacing strings, etc.

Manipulates data by extracting substrings, counting number of characters, replacing strings, etc.

Page 9: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

SUBSTR FunctionSUBSTR Function

Used to return a substring, or portion of a stringUsed to return a substring, or portion of a string

Page 10: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

LENGTH FunctionLENGTH Function

Used to determine the number of characters in a stringUsed to determine the number of characters in a string

Page 11: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

LTRIM and RTRIM FunctionsLTRIM and RTRIM Functions

Used to remove a specific string of charactersUsed to remove a specific string of characters

Page 12: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

REPLACE FunctionREPLACE Function

Substitutes a string with another specified stringSubstitutes a string with another specified string

Page 13: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

CONCAT FunctionCONCAT Function

Used to concatenate two character stringsUsed to concatenate two character strings

Page 14: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

ROUND FunctionROUND Function

Used to round numeric columns to a stated precision

Used to round numeric columns to a stated precision

Page 15: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

MONTHS_BETWEEN FunctionMONTHS_BETWEEN Function

Determines the number of months between two datesDetermines the number of months between two dates

Page 16: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

ADD_MONTHS FunctionADD_MONTHS Function

Adds a specified number of months to a dateAdds a specified number of months to a date

Page 17: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

NEXT_DAY FunctionNEXT_DAY Function

Determines the next occurrence of a specified day of the week after a given date

Determines the next occurrence of a specified day of the week after a given date

Page 18: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

DECODE FunctionDECODE Function

Determines action based upon values in a listDetermines action based upon values in a list

Page 19: Chapter 5 Selected Single-Row Functions. Chapter Objectives  Use the UPPER, LOWER, and INITCAP functions to change the case of field values and character

Nesting FunctionsNesting Functions

One function is used as an argument inside another function

Must include all arguments for each function Inner function is resolved first, then outer

function

One function is used as an argument inside another function

Must include all arguments for each function Inner function is resolved first, then outer

function