SlideShare a Scribd company logo
Key Functions in Oracle SQL
                                                                                 Page 1 of 6



             Key Functions in Oracle SQL

Use this Quick Reference Guide to locate functions you can use
in your queries. There are five tables in this guide: Grouping
Functions, Numeric Functions, String Functions, Date
Functions, and Conversion Functions.

             Grouping functions may include either of the keywords DISTINCT or ALL.
             ALL is the default if neither is specified and uses all selected rows in the
             calculation. DISTINCT uses only one row for each value in the
             calculation.
             Example:
             •     AVG(ALL 2,2,3,3,4) and AVG(2,2,3,3,4) both return 2.8.
             •     AVG(DISTINCT 2,2,3,3,4) returns 3.


    Grouping                              Meaning and Example
  Functions and
   Parameters
 AVG(expression)        Returns the average of the values in a set of rows
                        Example:
                        •     AVG(endowment_unit_value)
 COUNT(expression)      Returns the number of rows in the set
 or COUNT(*)
                        Note: If you include an expression, COUNT returns only the
                              number of rows in which the expression is not null.
                              COUNT(*) counts all rows. Since no HDW table
                              contains nulls, COUNT(expression) and COUNT(*) are
                              equivalent.
                        Example:
                        •     COUNT(*)
                        •     COUNT(DISTINCT univ_id_no)
 MAX(expression)        Returns the largest value from a set of rows
                        Note: See the GREATEST function if you want the largest of
                              a series of values in a single row.
                        Example (returns the date on which the most recent change
                        was made to dwfnd_rf_tub_cds):
                        •     MAX(tub_last_update_dt)
     (continued on next page)
DD004QR3 - Key Functions In
Oracle SQL.Doc                                                                         4-1
Rev 3, 10/1/99
Key Functions in Oracle SQL
Page 2 of 6


Grouping Functions (continued)
     Grouping                              Meaning and Example
   Functions and
    Parameters
 MIN(expression)        Returns the smallest value from a set of rows
                        Note: See the LEAST function if you want the smallest of a
                              series of values in a single row.
                        Example (returns the lowest rate used for fringe-benefit
                        assessments):
                        •     MIN(fringe_assessment_rate)
 SUM(expression)        Adds the value for all rows in the query or for all rows with the
                        same values for columns listed in the GROUP BY clause
                        Example:
                        •     SUM(pcard_transaction_distr_amt)



     Numeric                               Meaning and Example
   Functions and
    Parameters
 ABS(number)            Removes the sign, if any, returning a positive value
                        Example (selects actual_amt values above 10,000 and below
                        –10,000):
                        •     ABS(actual_amt) > 10000
 GREATEST(value1,       Returns the largest of the values in the list
 value2, …)
                        Note: This function is used for multiple values in the same
                              row. See the MAX function if you want the largest
                              value from a group of rows.
                        Example:
                        •     GREATEST(pcard_dt_modified, pcard_dt_reviewed)
 LEAST(value1,          Returns the smallest of the values in the list
 value2, …)
                        Note: This function is used for multiple values in the same
                              row. See the MIN function if you want the smallest
                              value from a group of rows.
                        Example:
                        •     LEAST(pcard_dt_modified, pcard_dt_reviewed,
                              pcard_swept_dt)
      (continued on next page)

                                                                 DD004QR3 - Key Functions
4-2                                                                    In Oracle SQL.Doc
                                                                           Rev 3, 10/1/99
Key Functions in Oracle SQL
                                                                                   Page 3 of 6


Numeric Functions (continued)
     Numeric                                 Meaning and Example
   Functions and
    Parameters
 ROUND(number,         Rounds a value to the specified number of decimal places
 decimal places)
                       Example:
                       •      ROUND(123.456,2) returns 123.46
                       •      ROUND(234567.00,-3) returns 235000
 TRUNC(number,         Cuts off a value at the specified number of decimal places
 decimal places)
                       Example:
                       •      TRUNC(123.456,2) returns 123.45
                       •      TRUNC(234567.00,-3) returns 234000



 String Functions                            Meaning and Example
 and Parameters
 string || string      Concatenates string values
                       Note: The equivalent CONCAT function accepts only two
                             arguments and is more confusing in queries.
                       Example:
                       •      vendor_city || ‘, ‘ || vendor_state || ‘ ‘ || vendor_postal_cd
 INITCAP(string)       Converts a string to initial capital letters
                       Note: This function will convert “a,” “an,” and “the” to “A,”
                             “An,” and “The.”
                       Example:
                       •      INITCAP(vendor_name)
 LENGTH(string)        Returns the number of characters in a string
                       Example:
                       •      LENGTH(full_name)
 LOWER(string)         Converts a string to all lowercase characters
                       Example:
                       •      LOWER(view_name)
      (continued on next page)



DD004QR3 - Key Functions In
Oracle SQL.Doc                                                                             4-3
Rev 3, 10/1/99
Key Functions in Oracle SQL
Page 4 of 6


String Functions (continued)
 String Functions                          Meaning and Example
 and Parameters
 SUBSTR(string,         Extracts a portion of a string
 starting value,
                        Note: If the starting value is 0, it is treated as 1. If the
 number of
                              starting-value is negative, Oracle counts backward
 characters)
                              from the end of the string. If the starting value is
                              positive, Oracle counts forward from the beginning of
                              the string.
                        Example:
                        •     SUBSTR(‘ABCDEF’,2,3) returns ‘BCD’
                        •     SUBSTR(‘abcdef’,-4,3) returns ‘cde’
 UPPER(string)          Converts a string to all uppercase characters
                        Example:
                        •     WHERE UPPER(lodging_location) LIKE ‘%CHICAGO%’



  Date Functions                           Meaning and Example
  and Parameters
 ADD_MONTHS             Adds the specified number of months to the date value
 (date, number of       (subtracts months if the number of months is negative)
 months)
                        Note: If the result would be a date beyond the end of the
                              month, Oracle returns the last day of the resulting
                              month.
                        Example (selects expense reports not settled for more than
                        two months after trip end):
                        •     WHERE report_gl_export_dt > ADD_MONTHS(report_
                              trip_end_or_expense_dt, 2)
 LAST_DAY(date)         Returns the last day of the month that contains the date
                        Example (returns ‘29-FEB-2000’):
                        •     LAST_DAY(‘15-FEB-2000’)
      (continued on next page)




                                                               DD004QR3 - Key Functions
4-4                                                                  In Oracle SQL.Doc
                                                                         Rev 3, 10/1/99
Key Functions in Oracle SQL
                                                                               Page 5 of 6


Date Functions (continued)
  Date Functions                          Meaning and Example
  and Parameters
 MONTHS_               Returns the difference between two dates expressed as whole
 BETWEEN(date1,        and fractional months
 date2)
                       Note: If date1 is earlier than date2, the result is negative.
                             The result also takes into account time differences
                             between the two values.
                       Example (returns 1.03225806):
                       •      MONTHS_BETWEEN(‘02-FEB-2001’,’01-JAN-2001’)
 NEXT_DAY(date,        Returns the date of the first day of the specified name that is
 day name)             later than the date supplied
                       Example (returns ‘20-MAR-2001’):
                       •      NEXT_DAY(‘14-MAR-2001’,’TUESDAY’)
 ROUND (datetime,      Returns the date-time rounded to the unit specified by the
 format)               format, or to the nearest day if no format is supplied
                       Note: For details on available formats, see the full
                             description of functions (below).
                       Example: (returns ‘01-JAN-2000’)
                       •      ROUND(‘27-OCT-1999’, ‘YEAR’)
 SYSDATE               Returns the current date-time from the server where the
                       database is located
                       Example (returns rows posted the previous day):
                       •      WHERE je_posted_dt = TRUNC(SYSDATE) – 1
 TRUNC(datetime)       Removes the time component from a date-time value
                       Note: This function has other truncating options. See the full
                             description of functions (below) for details.
                       Example:
                       •      WHERE TRUNC(je_posted_dt) = ‘12-OCT-99’




DD004QR3 - Key Functions In
Oracle SQL.Doc                                                                           4-5
Rev 3, 10/1/99
Key Functions in Oracle SQL
Page 6 of 6




    Conversion                              Meaning and Example
   Functions and
    Parameters
 TO_CHAR(date,           Converts a date to a string in the specified format
 format)
                         Note: For details on available formats, see the full
                               description of functions (below).
                         Example:
                         •    TO_CHAR(je_posted_dt, ‘Month DD, YYYY’)
 TO_CHAR(number,         Converts a number to a string in the specified format
 format)
                         Example:
                         •    TO_CHAR(fund_spec_invest_amt,’$9,999,999’)
 TO_DATE(string,         Converts a string to a date using the specified format
 format)
                         Note: Oracle automatically converts dates in the standard
                               format of DD-MON-YYYY.
                         Example:
                         •    TO_DATE(‘01-02-1999’, ‘DD-MM-YYYY’)
 TO_NUMBER               Converts a string to a number using the optional format if
 (string, format)        specified
                         Note: For details on available formats, see the full
                               description of functions (below).
                         Example:
                         •    TO_NUMBER(‘100.00’,’9G999D99’)
                         •    TO_NUMBER(TO_CHAR(je_posted_dt, ‘YYYY’))


               This list includes only the most commonly used Oracle functions. To
               download the full descriptions of all Oracle functions, navigate to the
               Forms section of ABLE and choose Ad-Hoc Reporting Forms, then
               Oracle Manuals.




                                                                  DD004QR3 - Key Functions
4-6                                                                     In Oracle SQL.Doc
                                                                            Rev 3, 10/1/99

More Related Content

What's hot

Arrays and structures
Arrays and structuresArrays and structures
Arrays and structures
Mohd Arif
 
Data Types and Structures in R
Data Types and Structures in RData Types and Structures in R
Data Types and Structures in R
Rupak Roy
 
Data Management in Python
Data Management in PythonData Management in Python
Data Management in Python
Sankhya_Analytics
 
3 Data Structure in R
3 Data Structure in R3 Data Structure in R
3 Data Structure in R
Dr Nisha Arora
 
Pandas Cheat Sheet
Pandas Cheat SheetPandas Cheat Sheet
Pandas Cheat Sheet
ACASH1011
 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
Khaled Al-Shamaa
 
Functional Programming in R
Functional Programming in RFunctional Programming in R
Functional Programming in R
Soumendra Dhanee
 
finding Min and max element from given array using divide & conquer
finding Min and max element from given array using  divide & conquer finding Min and max element from given array using  divide & conquer
finding Min and max element from given array using divide & conquer
Swati Kulkarni Jaipurkar
 
State space courses
State space coursesState space courses
State space courses
KAMEL HEMSAS
 
Data Structures - Lecture 3 [Arrays]
Data Structures - Lecture 3 [Arrays]Data Structures - Lecture 3 [Arrays]
Data Structures - Lecture 3 [Arrays]
Muhammad Hammad Waseem
 
Unit3 C
Unit3 C Unit3 C
Unit3 C
arnold 7490
 
Arrays
ArraysArrays
Arrays
Faisal Aziz
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
University of Salerno
 
DataWeave 2.0 - MuleSoft CONNECT 2019
DataWeave 2.0 - MuleSoft CONNECT 2019DataWeave 2.0 - MuleSoft CONNECT 2019
DataWeave 2.0 - MuleSoft CONNECT 2019
Sabrina Marechal
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923
Raman Kannan
 
8 python data structure-1
8 python data structure-18 python data structure-1
8 python data structure-1
Prof. Dr. K. Adisesha
 
Introduction to r studio on aws 2020 05_06
Introduction to r studio on aws 2020 05_06Introduction to r studio on aws 2020 05_06
Introduction to r studio on aws 2020 05_06
Barry DeCicco
 
Python data handling notes
Python data handling notesPython data handling notes
Python data handling notes
Prof. Dr. K. Adisesha
 
Statistics lab 1
Statistics lab 1Statistics lab 1
Statistics lab 1
University of Salerno
 
R short-refcard
R short-refcardR short-refcard
R short-refcard
conline
 

What's hot (20)

Arrays and structures
Arrays and structuresArrays and structures
Arrays and structures
 
Data Types and Structures in R
Data Types and Structures in RData Types and Structures in R
Data Types and Structures in R
 
Data Management in Python
Data Management in PythonData Management in Python
Data Management in Python
 
3 Data Structure in R
3 Data Structure in R3 Data Structure in R
3 Data Structure in R
 
Pandas Cheat Sheet
Pandas Cheat SheetPandas Cheat Sheet
Pandas Cheat Sheet
 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 
Functional Programming in R
Functional Programming in RFunctional Programming in R
Functional Programming in R
 
finding Min and max element from given array using divide & conquer
finding Min and max element from given array using  divide & conquer finding Min and max element from given array using  divide & conquer
finding Min and max element from given array using divide & conquer
 
State space courses
State space coursesState space courses
State space courses
 
Data Structures - Lecture 3 [Arrays]
Data Structures - Lecture 3 [Arrays]Data Structures - Lecture 3 [Arrays]
Data Structures - Lecture 3 [Arrays]
 
Unit3 C
Unit3 C Unit3 C
Unit3 C
 
Arrays
ArraysArrays
Arrays
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
DataWeave 2.0 - MuleSoft CONNECT 2019
DataWeave 2.0 - MuleSoft CONNECT 2019DataWeave 2.0 - MuleSoft CONNECT 2019
DataWeave 2.0 - MuleSoft CONNECT 2019
 
Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923Evaluating classifierperformance ml-cs6923
Evaluating classifierperformance ml-cs6923
 
8 python data structure-1
8 python data structure-18 python data structure-1
8 python data structure-1
 
Introduction to r studio on aws 2020 05_06
Introduction to r studio on aws 2020 05_06Introduction to r studio on aws 2020 05_06
Introduction to r studio on aws 2020 05_06
 
Python data handling notes
Python data handling notesPython data handling notes
Python data handling notes
 
Statistics lab 1
Statistics lab 1Statistics lab 1
Statistics lab 1
 
R short-refcard
R short-refcardR short-refcard
R short-refcard
 

Viewers also liked

Presentación1 ingles
Presentación1 inglesPresentación1 ingles
Presentación1 ingles
katherynthaly
 
Al anood al-otaibi
Al anood al-otaibiAl anood al-otaibi
Al anood al-otaibi
Queenriyadh
 
Al anood al-otaibi
Al anood al-otaibiAl anood al-otaibi
Al anood al-otaibi
Queenriyadh
 
Water matters
Water mattersWater matters
Water matters
RendraGani
 
Animal
AnimalAnimal
Animal
RendraGani
 
A synapse 2014.9.9 (for japan)
A synapse 2014.9.9 (for japan)A synapse 2014.9.9 (for japan)
A synapse 2014.9.9 (for japan)
Makoto Nakayama
 
Chek siang and_alger
Chek siang and_algerChek siang and_alger
Chek siang and_alger
RendraGani
 
Haikels group
Haikels groupHaikels group
Haikels group
RendraGani
 
Cells
CellsCells
Cells
RendraGani
 
Heredity ^ ^
Heredity ^ ^Heredity ^ ^
Heredity ^ ^
RendraGani
 
Sci project!
Sci project!Sci project!
Sci project!
RendraGani
 
Reproduction in plants_3
Reproduction in plants_3Reproduction in plants_3
Reproduction in plants_3
RendraGani
 
Hayao Miyazaki
Hayao MiyazakiHayao Miyazaki
Hayao Miyazaki
cbugs47
 
Plants
PlantsPlants
Plants
RendraGani
 
Alta Group's Emerging Market Research - "Why Mexico?"
Alta Group's Emerging Market Research - "Why Mexico?"Alta Group's Emerging Market Research - "Why Mexico?"
Alta Group's Emerging Market Research - "Why Mexico?"
Alta Ventures México
 

Viewers also liked (16)

Presentación1 ingles
Presentación1 inglesPresentación1 ingles
Presentación1 ingles
 
Al anood al-otaibi
Al anood al-otaibiAl anood al-otaibi
Al anood al-otaibi
 
Al anood al-otaibi
Al anood al-otaibiAl anood al-otaibi
Al anood al-otaibi
 
Water matters
Water mattersWater matters
Water matters
 
Animal
AnimalAnimal
Animal
 
Spp042012
Spp042012Spp042012
Spp042012
 
A synapse 2014.9.9 (for japan)
A synapse 2014.9.9 (for japan)A synapse 2014.9.9 (for japan)
A synapse 2014.9.9 (for japan)
 
Chek siang and_alger
Chek siang and_algerChek siang and_alger
Chek siang and_alger
 
Haikels group
Haikels groupHaikels group
Haikels group
 
Cells
CellsCells
Cells
 
Heredity ^ ^
Heredity ^ ^Heredity ^ ^
Heredity ^ ^
 
Sci project!
Sci project!Sci project!
Sci project!
 
Reproduction in plants_3
Reproduction in plants_3Reproduction in plants_3
Reproduction in plants_3
 
Hayao Miyazaki
Hayao MiyazakiHayao Miyazaki
Hayao Miyazaki
 
Plants
PlantsPlants
Plants
 
Alta Group's Emerging Market Research - "Why Mexico?"
Alta Group's Emerging Market Research - "Why Mexico?"Alta Group's Emerging Market Research - "Why Mexico?"
Alta Group's Emerging Market Research - "Why Mexico?"
 

Similar to Key functions in_oracle_sql

Mysql1
Mysql1Mysql1
Mysql1
rajikaa
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
Vikas Gupta
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
MARasheed3
 
Oracle sql functions
Oracle sql functionsOracle sql functions
Oracle sql functions
Vivek Singh
 
12th.pptx
12th.pptx12th.pptx
12th.pptx
AamirMaqsood8
 
Sql functions
Sql functionsSql functions
Sql functions
G C Reddy Technologies
 
mysql.ppt
mysql.pptmysql.ppt
mysql.ppt
nawaz65
 
Unit 3 - Function & Grouping,Joins and Set Operations in ORACLE
Unit 3 - Function & Grouping,Joins and Set Operations in ORACLEUnit 3 - Function & Grouping,Joins and Set Operations in ORACLE
Unit 3 - Function & Grouping,Joins and Set Operations in ORACLE
DrkhanchanaR
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
SANTOSH RATH
 
Sql functions
Sql functionsSql functions
Sql functions
Ankit Dubey
 
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek SharmaIntroduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
अभिषेक शर्मा
 
Intro to tsql unit 10
Intro to tsql   unit 10Intro to tsql   unit 10
Intro to tsql unit 10
Syed Asrarali
 
Oracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsOracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic Functions
Zohar Elkayam
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and Operators
Mohan Kumar.R
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
Nalina Kumari
 
Mysql
MysqlMysql
Mysql
MysqlMysql
Mysql
MysqlMysql
Analytic & Windowing functions in oracle
Analytic & Windowing functions in oracleAnalytic & Windowing functions in oracle
Analytic & Windowing functions in oracle
Logan Palanisamy
 
Sql wksht-3
Sql wksht-3Sql wksht-3
Sql wksht-3
Mukesh Tekwani
 

Similar to Key functions in_oracle_sql (20)

Mysql1
Mysql1Mysql1
Mysql1
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
 
Oracle sql functions
Oracle sql functionsOracle sql functions
Oracle sql functions
 
12th.pptx
12th.pptx12th.pptx
12th.pptx
 
Sql functions
Sql functionsSql functions
Sql functions
 
mysql.ppt
mysql.pptmysql.ppt
mysql.ppt
 
Unit 3 - Function & Grouping,Joins and Set Operations in ORACLE
Unit 3 - Function & Grouping,Joins and Set Operations in ORACLEUnit 3 - Function & Grouping,Joins and Set Operations in ORACLE
Unit 3 - Function & Grouping,Joins and Set Operations in ORACLE
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
Sql functions
Sql functionsSql functions
Sql functions
 
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek SharmaIntroduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
 
Intro to tsql unit 10
Intro to tsql   unit 10Intro to tsql   unit 10
Intro to tsql unit 10
 
Oracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsOracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic Functions
 
SQL Functions and Operators
SQL Functions and OperatorsSQL Functions and Operators
SQL Functions and Operators
 
Structure query language (sql)
Structure query language (sql)Structure query language (sql)
Structure query language (sql)
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Mysql
MysqlMysql
Mysql
 
Analytic & Windowing functions in oracle
Analytic & Windowing functions in oracleAnalytic & Windowing functions in oracle
Analytic & Windowing functions in oracle
 
Sql wksht-3
Sql wksht-3Sql wksht-3
Sql wksht-3
 

Recently uploaded

South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 

Recently uploaded (20)

South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 

Key functions in_oracle_sql

  • 1. Key Functions in Oracle SQL Page 1 of 6 Key Functions in Oracle SQL Use this Quick Reference Guide to locate functions you can use in your queries. There are five tables in this guide: Grouping Functions, Numeric Functions, String Functions, Date Functions, and Conversion Functions. Grouping functions may include either of the keywords DISTINCT or ALL. ALL is the default if neither is specified and uses all selected rows in the calculation. DISTINCT uses only one row for each value in the calculation. Example: • AVG(ALL 2,2,3,3,4) and AVG(2,2,3,3,4) both return 2.8. • AVG(DISTINCT 2,2,3,3,4) returns 3. Grouping Meaning and Example Functions and Parameters AVG(expression) Returns the average of the values in a set of rows Example: • AVG(endowment_unit_value) COUNT(expression) Returns the number of rows in the set or COUNT(*) Note: If you include an expression, COUNT returns only the number of rows in which the expression is not null. COUNT(*) counts all rows. Since no HDW table contains nulls, COUNT(expression) and COUNT(*) are equivalent. Example: • COUNT(*) • COUNT(DISTINCT univ_id_no) MAX(expression) Returns the largest value from a set of rows Note: See the GREATEST function if you want the largest of a series of values in a single row. Example (returns the date on which the most recent change was made to dwfnd_rf_tub_cds): • MAX(tub_last_update_dt) (continued on next page) DD004QR3 - Key Functions In Oracle SQL.Doc 4-1 Rev 3, 10/1/99
  • 2. Key Functions in Oracle SQL Page 2 of 6 Grouping Functions (continued) Grouping Meaning and Example Functions and Parameters MIN(expression) Returns the smallest value from a set of rows Note: See the LEAST function if you want the smallest of a series of values in a single row. Example (returns the lowest rate used for fringe-benefit assessments): • MIN(fringe_assessment_rate) SUM(expression) Adds the value for all rows in the query or for all rows with the same values for columns listed in the GROUP BY clause Example: • SUM(pcard_transaction_distr_amt) Numeric Meaning and Example Functions and Parameters ABS(number) Removes the sign, if any, returning a positive value Example (selects actual_amt values above 10,000 and below –10,000): • ABS(actual_amt) > 10000 GREATEST(value1, Returns the largest of the values in the list value2, …) Note: This function is used for multiple values in the same row. See the MAX function if you want the largest value from a group of rows. Example: • GREATEST(pcard_dt_modified, pcard_dt_reviewed) LEAST(value1, Returns the smallest of the values in the list value2, …) Note: This function is used for multiple values in the same row. See the MIN function if you want the smallest value from a group of rows. Example: • LEAST(pcard_dt_modified, pcard_dt_reviewed, pcard_swept_dt) (continued on next page) DD004QR3 - Key Functions 4-2 In Oracle SQL.Doc Rev 3, 10/1/99
  • 3. Key Functions in Oracle SQL Page 3 of 6 Numeric Functions (continued) Numeric Meaning and Example Functions and Parameters ROUND(number, Rounds a value to the specified number of decimal places decimal places) Example: • ROUND(123.456,2) returns 123.46 • ROUND(234567.00,-3) returns 235000 TRUNC(number, Cuts off a value at the specified number of decimal places decimal places) Example: • TRUNC(123.456,2) returns 123.45 • TRUNC(234567.00,-3) returns 234000 String Functions Meaning and Example and Parameters string || string Concatenates string values Note: The equivalent CONCAT function accepts only two arguments and is more confusing in queries. Example: • vendor_city || ‘, ‘ || vendor_state || ‘ ‘ || vendor_postal_cd INITCAP(string) Converts a string to initial capital letters Note: This function will convert “a,” “an,” and “the” to “A,” “An,” and “The.” Example: • INITCAP(vendor_name) LENGTH(string) Returns the number of characters in a string Example: • LENGTH(full_name) LOWER(string) Converts a string to all lowercase characters Example: • LOWER(view_name) (continued on next page) DD004QR3 - Key Functions In Oracle SQL.Doc 4-3 Rev 3, 10/1/99
  • 4. Key Functions in Oracle SQL Page 4 of 6 String Functions (continued) String Functions Meaning and Example and Parameters SUBSTR(string, Extracts a portion of a string starting value, Note: If the starting value is 0, it is treated as 1. If the number of starting-value is negative, Oracle counts backward characters) from the end of the string. If the starting value is positive, Oracle counts forward from the beginning of the string. Example: • SUBSTR(‘ABCDEF’,2,3) returns ‘BCD’ • SUBSTR(‘abcdef’,-4,3) returns ‘cde’ UPPER(string) Converts a string to all uppercase characters Example: • WHERE UPPER(lodging_location) LIKE ‘%CHICAGO%’ Date Functions Meaning and Example and Parameters ADD_MONTHS Adds the specified number of months to the date value (date, number of (subtracts months if the number of months is negative) months) Note: If the result would be a date beyond the end of the month, Oracle returns the last day of the resulting month. Example (selects expense reports not settled for more than two months after trip end): • WHERE report_gl_export_dt > ADD_MONTHS(report_ trip_end_or_expense_dt, 2) LAST_DAY(date) Returns the last day of the month that contains the date Example (returns ‘29-FEB-2000’): • LAST_DAY(‘15-FEB-2000’) (continued on next page) DD004QR3 - Key Functions 4-4 In Oracle SQL.Doc Rev 3, 10/1/99
  • 5. Key Functions in Oracle SQL Page 5 of 6 Date Functions (continued) Date Functions Meaning and Example and Parameters MONTHS_ Returns the difference between two dates expressed as whole BETWEEN(date1, and fractional months date2) Note: If date1 is earlier than date2, the result is negative. The result also takes into account time differences between the two values. Example (returns 1.03225806): • MONTHS_BETWEEN(‘02-FEB-2001’,’01-JAN-2001’) NEXT_DAY(date, Returns the date of the first day of the specified name that is day name) later than the date supplied Example (returns ‘20-MAR-2001’): • NEXT_DAY(‘14-MAR-2001’,’TUESDAY’) ROUND (datetime, Returns the date-time rounded to the unit specified by the format) format, or to the nearest day if no format is supplied Note: For details on available formats, see the full description of functions (below). Example: (returns ‘01-JAN-2000’) • ROUND(‘27-OCT-1999’, ‘YEAR’) SYSDATE Returns the current date-time from the server where the database is located Example (returns rows posted the previous day): • WHERE je_posted_dt = TRUNC(SYSDATE) – 1 TRUNC(datetime) Removes the time component from a date-time value Note: This function has other truncating options. See the full description of functions (below) for details. Example: • WHERE TRUNC(je_posted_dt) = ‘12-OCT-99’ DD004QR3 - Key Functions In Oracle SQL.Doc 4-5 Rev 3, 10/1/99
  • 6. Key Functions in Oracle SQL Page 6 of 6 Conversion Meaning and Example Functions and Parameters TO_CHAR(date, Converts a date to a string in the specified format format) Note: For details on available formats, see the full description of functions (below). Example: • TO_CHAR(je_posted_dt, ‘Month DD, YYYY’) TO_CHAR(number, Converts a number to a string in the specified format format) Example: • TO_CHAR(fund_spec_invest_amt,’$9,999,999’) TO_DATE(string, Converts a string to a date using the specified format format) Note: Oracle automatically converts dates in the standard format of DD-MON-YYYY. Example: • TO_DATE(‘01-02-1999’, ‘DD-MM-YYYY’) TO_NUMBER Converts a string to a number using the optional format if (string, format) specified Note: For details on available formats, see the full description of functions (below). Example: • TO_NUMBER(‘100.00’,’9G999D99’) • TO_NUMBER(TO_CHAR(je_posted_dt, ‘YYYY’)) This list includes only the most commonly used Oracle functions. To download the full descriptions of all Oracle functions, navigate to the Forms section of ABLE and choose Ad-Hoc Reporting Forms, then Oracle Manuals. DD004QR3 - Key Functions 4-6 In Oracle SQL.Doc Rev 3, 10/1/99