SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Built-in Functions in SQL
Numeric Functions
Function Input Argument Value Returned
ABS ( m ) m = value Absolute value of m
MOD ( m, n ) m = value, n = divisor Remainder of m divided by n
POWER ( m, n ) m = value, n = exponent m raised to the nth power
ROUND ( m [, n ] )
m = value, n = number of decimal
places, default 0
m rounded to the nth decimal place
TRUNC ( m [, n ] )
m = value, n = number of decimal
places, default 0
m truncated to the nth decimal place
SIN ( n ) n = angle expressed in radians sine (n)
COS ( n ) n = angle expressed in radians cosine (n)
TAN ( n ) n = angle expressed in radians tan (n)
SQRT ( n ) n = value positive square root of n
EXP ( n ) n = value e raised to the power n
LN ( n ) n > 0 natural logarithm of n
LOG ( n2, n1 )
base n2 any positive value other
than 0 or 1, n1 any positive value
logarithm of n1, base n2
CEIL ( n ) n = value
smallest integer greater than or equal
to n
FLOOR ( n ) n = value
greatest integer smaller than or equal
to n
SIGN ( n ) n = value -1 if n < 0, 0 if n = 0, and 1 if n > 0
SQL Server allows DUAL to be specified as a table in queries that do not need data from any tables.
Here are some examples of the use of some of these numeric functions:
select round (83.28749,2) from dual;
or simply write
select round (83.28749,2);
select sqrt (3.67) from dual;
select power (2.512,5) from dual;
String Functions
Function Input Argument Value Returned
INITCAP ( s ) s = character string
First letter of each word is changed to
uppercase and all other letters are in lower
case.
LOWER ( s ) s = character string All letters are changed to lowercase.
UPPER ( s ) s = character string All letters are changed to uppercase.
CONCAT ( s1, s2 )
s1 and s2 are character
strings
Concatenation of s1 and s2. Equivalent to s1
|| s2
LPAD ( s1, n [, s2] )
s1 and s2 are character
strings and n is an
integer value
Returns s1 right justified and padded left
with n characters from s2; s2 defaults to
space.
RPAD ( s1, n [, s2] )
s1 and s2 are character
strings and n is an
integer value
Returns s1 left justified and padded right
with n characters from s2; s2 defaults to
space.
LTRIM ( s [, set ] )
s is a character string
and set is a set of
characters
Returns s with characters removed up to
the first character not in set; defaults to space
RTRIM ( s [, set ] )
s is a character string
and set is a set of
characters
Returns s with final characters removed after
the last character not in set; defaults to space
REPLACE ( s, search_s
[, replace_s ] )
s = character string,
search_s = target
string, replace_s =
replacement string
Returns s with every occurrence of search_s
in s replaced by replace_s; default removes
search_s
SUBSTR ( s, m [, n ] )
s = character string, m
= beginning position, n
= number of characters
Returns a substring from s, beginning in
position m and n characters long; default
returns to end of s.
LENGTH ( s ) s = character string Returns the number of characters in s.
INSTR ( s1, s2 [, m [, n
] ] )
s1 and s2 are character
strings, m = beginning
position, n =
occurrence of s2 in s1
Returns the position of the nth occurrence of
s2 in s1, beginning at position m, both m and
n default to 1.
Here are some examples of the use of String functions:
select concat ('Alan', 'Turing') as "NAME" from dual;
select 'Alan' || 'Turing' as "NAME" from dual;
select initcap ("now is the time for all good men to come to the aid of the
party") as "SLOGAN" from dual;
select substr('Alan Turing', 1, 4) as "FIRST" from dual;
String / Number Conversion Functions
Function Input Argument Value Returned
TO_CHAR ( m [, fmt ] )
m = numeric value,
fmt = format
Number m converted to character
string as specified by the format
TO_NUMBER ( s [, fmt ] )
s = character string,
fmt = format
Character string s converted to a
number as specified by the format
Formats for TO_CHAR Function
Symbol Explanation
9
Each 9 represents one digit in the
result
0
Represents a leading zero to be
displayed
$
Floating dollar sign printed to the left
of number
L Any local floating currency symbol
. Prints the decimal point
,
Prints the comma to represent
thousands
Group Functions
Function
Input
Argument
Value Returned
AVG ( [ DISTINCT | ALL
] col )
col = column
name
The average value of that column
COUNT ( * ) none
Number of rows returned including
duplicates and NULLs
COUNT ( [ DISTINCT |
ALL ] col )
col = column
name
Number of rows where the value of the
column is not NULL
MAX ( [ DISTINCT | ALL
] col )
col = column
name
Maximum value in the column
MIN ( [ DISTINCT | ALL
] col )
col = column
name
Minimum value in the column
SUM ( [ DISTINCT | ALL
] col )
col = column
name
Sum of the values in the column
Date and Time Functions
Function Input Argument Value Returned
ADD_MONTHS ( d, n )
d = date, n = number of
months
Date d plus n months
LAST_DAY ( d ) d = date
Date of the last day of the
month containing d
MONTHS_BETWEEN (
d, e )
d and e are dates
Number of months by which e
precedes d
NEW_TIME ( d, a, b )
d = date, a = time zone
(char), b = time zone
(char)
The date and time in time zone
b when date d is for time zone a
NEXT_DAY ( d, day ) d = date, day = day of the Date of the first day of the
week week after d
SYSDATE() none Current date and time
GREATEST ( d1, d2, ...,
dn )
d1 ... dn = list of dates Latest of the given dates
LEAST ( d1, d2, ..., dn ) d1 ... dn = list of dates Earliest of the given dates
Try:
SELECT SYSDATE();
SELECT LAST_DAY(SYSDATE());
Date Formats
Format Code Description Range of Values
DD Day of the month 1 - 31
DY Name of the day in 3 uppercase letters SUN, ..., SAT
DAY
Complete name of the day in uppercase,
padded to 9 characters
SUNDAY, ...,
SATURDAY
MM Number of the month 1 - 12
MON
Name of the month in 3 uppercase
letters
JAN, ..., DEC
MONTH
Name of the month in uppercase padded
to a length of 9 characters
JANUARY, ...,
DECEMBER
RM Roman numeral for the month I, ..., XII
YY or YYYY Two or four digit year 71 or 1971
HH:MI:SS Hours : Minutes : Seconds 10:28:53
HH 12 or HH
24
Hour displayed in 12 or 24 hour format 1 - 12 or 1 - 24
MI Minutes of the hour 0 - 59
SS Seconds of the minute 0 - 59
AM or PM Meridian indicator AM or PM

More Related Content

What's hot (20)

PDF
Functions torage class and array and strings-
aneebkmct
 
PDF
Reasoning about laziness
Johan Tibell
 
PDF
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
Philip Schwarz
 
PPT
Single row functions
Soumyajit Dutta
 
PPT
Introduction to Functional Programming in JavaScript
tmont
 
ODP
Clojure basics
Knoldus Inc.
 
PDF
Matlab quickref
Arduino Aficionado
 
PDF
Matlab practice
ZunAib Ali
 
PDF
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
PDF
Scala categorytheory
Knoldus Inc.
 
PDF
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
Philip Schwarz
 
PPTX
String in programming language in c or c++
Azeemaj101
 
PDF
Applicative Functor - Part 3
Philip Schwarz
 
PDF
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala
Philip Schwarz
 
PDF
Use Cases of Row Pattern Matching in Oracle 12c
Gerger
 
PPTX
Handling of character strings C programming
Appili Vamsi Krishna
 
PPTX
Introduction to matlab lecture 3 of 4
Randa Elanwar
 
PDF
Strings part2
yndaravind
 
PDF
Monad Fact #4
Philip Schwarz
 
PPTX
Introduction to matlab lecture 4 of 4
Randa Elanwar
 
Functions torage class and array and strings-
aneebkmct
 
Reasoning about laziness
Johan Tibell
 
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
Philip Schwarz
 
Single row functions
Soumyajit Dutta
 
Introduction to Functional Programming in JavaScript
tmont
 
Clojure basics
Knoldus Inc.
 
Matlab quickref
Arduino Aficionado
 
Matlab practice
ZunAib Ali
 
TI1220 Lecture 6: First-class Functions
Eelco Visser
 
Scala categorytheory
Knoldus Inc.
 
The Functional Programming Triad of Folding, Scanning and Iteration - a first...
Philip Schwarz
 
String in programming language in c or c++
Azeemaj101
 
Applicative Functor - Part 3
Philip Schwarz
 
Folding Unfolded - Polyglot FP for Fun and Profit - Haskell and Scala
Philip Schwarz
 
Use Cases of Row Pattern Matching in Oracle 12c
Gerger
 
Handling of character strings C programming
Appili Vamsi Krishna
 
Introduction to matlab lecture 3 of 4
Randa Elanwar
 
Strings part2
yndaravind
 
Monad Fact #4
Philip Schwarz
 
Introduction to matlab lecture 4 of 4
Randa Elanwar
 

Similar to Built-in Functions in SQL | Numeric Functions (20)

PPT
Oracle sql ppt2
Madhavendra Dutt
 
PDF
STRING LIST TUPLE DICTIONARY FILE.pdf
omprakashmeena48
 
PDF
ANSI C REFERENCE CARD
Tia Ricci
 
PPTX
SQL for pattern matching (Oracle 12c)
Logan Palanisamy
 
PPTX
MySQL String Functions.pptx
MayankSharma867296
 
PPTX
Functions
Ankit Dubey
 
DOCX
Functions data format
gtankariagt
 
PPTX
Unit 3 - Function & Grouping,Joins and Set Operations in ORACLE
DrkhanchanaR
 
PPTX
statistical computation using R- an intro..
Kamarudheen KV
 
PDF
Postgresql 9.3 overview
Aveic
 
PDF
DP080_Lecture_2 SQL related document.pdf
MinhTran394436
 
PDF
SQL BUILT-IN FUNCTION
Arun Sial
 
PPTX
string manipulation in python ppt for grade 11 cbse
KrithikaTM
 
PPT
string function with example...................
NishantsrivastavaV
 
PPT
Lesson in Strings for C Programming Lessons
JamesChristianGadian
 
PDF
time_complexity_list_02_04_2024_22_pages.pdf
SrinivasaReddyPolamR
 
PPTX
TCS_Digital_Advanced_Coding_Student copy.pptx
sec21ec116
 
PDF
Foxpro (1)
piyushrajsinha
 
PPT
Unit3 C
arnold 7490
 
Oracle sql ppt2
Madhavendra Dutt
 
STRING LIST TUPLE DICTIONARY FILE.pdf
omprakashmeena48
 
ANSI C REFERENCE CARD
Tia Ricci
 
SQL for pattern matching (Oracle 12c)
Logan Palanisamy
 
MySQL String Functions.pptx
MayankSharma867296
 
Functions
Ankit Dubey
 
Functions data format
gtankariagt
 
Unit 3 - Function & Grouping,Joins and Set Operations in ORACLE
DrkhanchanaR
 
statistical computation using R- an intro..
Kamarudheen KV
 
Postgresql 9.3 overview
Aveic
 
DP080_Lecture_2 SQL related document.pdf
MinhTran394436
 
SQL BUILT-IN FUNCTION
Arun Sial
 
string manipulation in python ppt for grade 11 cbse
KrithikaTM
 
string function with example...................
NishantsrivastavaV
 
Lesson in Strings for C Programming Lessons
JamesChristianGadian
 
time_complexity_list_02_04_2024_22_pages.pdf
SrinivasaReddyPolamR
 
TCS_Digital_Advanced_Coding_Student copy.pptx
sec21ec116
 
Foxpro (1)
piyushrajsinha
 
Unit3 C
arnold 7490
 
Ad

More from Raj vardhan (20)

PPTX
Software Testing Life Cycle Unit-3
Raj vardhan
 
PPTX
Internet Basics Unit-7
Raj vardhan
 
PPTX
Local Area Network – Wired LAN
Raj vardhan
 
PPTX
Network Connecting Devices UNIT 5
Raj vardhan
 
DOCX
UNIT 4-HEADER FILES IN C
Raj vardhan
 
PPTX
Wireless LANs(IEEE802.11) Architecture
Raj vardhan
 
PPTX
UNIT -03 Transmission Media and Connecting Devices
Raj vardhan
 
PDF
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
PPTX
Introduction To Software Concepts Unit 1 & 2
Raj vardhan
 
DOCX
Swachh Bharat Abhiyan - Project Report
Raj vardhan
 
DOCX
Network Topology
Raj vardhan
 
DOCX
Microsoft Office Word Introduction Complete
Raj vardhan
 
DOCX
Digital money Revolution Introduction
Raj vardhan
 
DOCX
C Programming
Raj vardhan
 
PPTX
Definition of Business
Raj vardhan
 
PPT
Business Terms & Concepts
Raj vardhan
 
PDF
Number System Conversion | BCA
Raj vardhan
 
DOCX
Interaction With Computers FIT
Raj vardhan
 
DOCX
FIT-MS-WORD Lab | BCA
Raj vardhan
 
PDF
Syllabus Front End Design Tool VB.NET | BCA-205
Raj vardhan
 
Software Testing Life Cycle Unit-3
Raj vardhan
 
Internet Basics Unit-7
Raj vardhan
 
Local Area Network – Wired LAN
Raj vardhan
 
Network Connecting Devices UNIT 5
Raj vardhan
 
UNIT 4-HEADER FILES IN C
Raj vardhan
 
Wireless LANs(IEEE802.11) Architecture
Raj vardhan
 
UNIT -03 Transmission Media and Connecting Devices
Raj vardhan
 
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
Introduction To Software Concepts Unit 1 & 2
Raj vardhan
 
Swachh Bharat Abhiyan - Project Report
Raj vardhan
 
Network Topology
Raj vardhan
 
Microsoft Office Word Introduction Complete
Raj vardhan
 
Digital money Revolution Introduction
Raj vardhan
 
C Programming
Raj vardhan
 
Definition of Business
Raj vardhan
 
Business Terms & Concepts
Raj vardhan
 
Number System Conversion | BCA
Raj vardhan
 
Interaction With Computers FIT
Raj vardhan
 
FIT-MS-WORD Lab | BCA
Raj vardhan
 
Syllabus Front End Design Tool VB.NET | BCA-205
Raj vardhan
 
Ad

Recently uploaded (20)

PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PDF
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PPTX
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
PPTX
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
Characteristics, Strengths and Weaknesses of Quantitative Research.pdf
Thelma Villaflores
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Aprendendo Arquitetura Framework Salesforce - Dia 03
Mauricio Alexandre Silva
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
Horarios de distribución de agua en julio
pegazohn1978
 
Identifying elements in the story. Arrange the events in the story
geraldineamahido2
 
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 

Built-in Functions in SQL | Numeric Functions

  • 1. Built-in Functions in SQL Numeric Functions Function Input Argument Value Returned ABS ( m ) m = value Absolute value of m MOD ( m, n ) m = value, n = divisor Remainder of m divided by n POWER ( m, n ) m = value, n = exponent m raised to the nth power ROUND ( m [, n ] ) m = value, n = number of decimal places, default 0 m rounded to the nth decimal place TRUNC ( m [, n ] ) m = value, n = number of decimal places, default 0 m truncated to the nth decimal place SIN ( n ) n = angle expressed in radians sine (n) COS ( n ) n = angle expressed in radians cosine (n) TAN ( n ) n = angle expressed in radians tan (n) SQRT ( n ) n = value positive square root of n EXP ( n ) n = value e raised to the power n LN ( n ) n > 0 natural logarithm of n LOG ( n2, n1 ) base n2 any positive value other than 0 or 1, n1 any positive value logarithm of n1, base n2 CEIL ( n ) n = value smallest integer greater than or equal to n FLOOR ( n ) n = value greatest integer smaller than or equal to n SIGN ( n ) n = value -1 if n < 0, 0 if n = 0, and 1 if n > 0 SQL Server allows DUAL to be specified as a table in queries that do not need data from any tables. Here are some examples of the use of some of these numeric functions: select round (83.28749,2) from dual; or simply write select round (83.28749,2); select sqrt (3.67) from dual; select power (2.512,5) from dual; String Functions Function Input Argument Value Returned INITCAP ( s ) s = character string First letter of each word is changed to uppercase and all other letters are in lower case. LOWER ( s ) s = character string All letters are changed to lowercase. UPPER ( s ) s = character string All letters are changed to uppercase.
  • 2. CONCAT ( s1, s2 ) s1 and s2 are character strings Concatenation of s1 and s2. Equivalent to s1 || s2 LPAD ( s1, n [, s2] ) s1 and s2 are character strings and n is an integer value Returns s1 right justified and padded left with n characters from s2; s2 defaults to space. RPAD ( s1, n [, s2] ) s1 and s2 are character strings and n is an integer value Returns s1 left justified and padded right with n characters from s2; s2 defaults to space. LTRIM ( s [, set ] ) s is a character string and set is a set of characters Returns s with characters removed up to the first character not in set; defaults to space RTRIM ( s [, set ] ) s is a character string and set is a set of characters Returns s with final characters removed after the last character not in set; defaults to space REPLACE ( s, search_s [, replace_s ] ) s = character string, search_s = target string, replace_s = replacement string Returns s with every occurrence of search_s in s replaced by replace_s; default removes search_s SUBSTR ( s, m [, n ] ) s = character string, m = beginning position, n = number of characters Returns a substring from s, beginning in position m and n characters long; default returns to end of s. LENGTH ( s ) s = character string Returns the number of characters in s. INSTR ( s1, s2 [, m [, n ] ] ) s1 and s2 are character strings, m = beginning position, n = occurrence of s2 in s1 Returns the position of the nth occurrence of s2 in s1, beginning at position m, both m and n default to 1. Here are some examples of the use of String functions: select concat ('Alan', 'Turing') as "NAME" from dual; select 'Alan' || 'Turing' as "NAME" from dual; select initcap ("now is the time for all good men to come to the aid of the party") as "SLOGAN" from dual; select substr('Alan Turing', 1, 4) as "FIRST" from dual; String / Number Conversion Functions Function Input Argument Value Returned TO_CHAR ( m [, fmt ] ) m = numeric value, fmt = format Number m converted to character string as specified by the format TO_NUMBER ( s [, fmt ] ) s = character string, fmt = format Character string s converted to a number as specified by the format
  • 3. Formats for TO_CHAR Function Symbol Explanation 9 Each 9 represents one digit in the result 0 Represents a leading zero to be displayed $ Floating dollar sign printed to the left of number L Any local floating currency symbol . Prints the decimal point , Prints the comma to represent thousands Group Functions Function Input Argument Value Returned AVG ( [ DISTINCT | ALL ] col ) col = column name The average value of that column COUNT ( * ) none Number of rows returned including duplicates and NULLs COUNT ( [ DISTINCT | ALL ] col ) col = column name Number of rows where the value of the column is not NULL MAX ( [ DISTINCT | ALL ] col ) col = column name Maximum value in the column MIN ( [ DISTINCT | ALL ] col ) col = column name Minimum value in the column SUM ( [ DISTINCT | ALL ] col ) col = column name Sum of the values in the column Date and Time Functions Function Input Argument Value Returned ADD_MONTHS ( d, n ) d = date, n = number of months Date d plus n months LAST_DAY ( d ) d = date Date of the last day of the month containing d MONTHS_BETWEEN ( d, e ) d and e are dates Number of months by which e precedes d NEW_TIME ( d, a, b ) d = date, a = time zone (char), b = time zone (char) The date and time in time zone b when date d is for time zone a NEXT_DAY ( d, day ) d = date, day = day of the Date of the first day of the
  • 4. week week after d SYSDATE() none Current date and time GREATEST ( d1, d2, ..., dn ) d1 ... dn = list of dates Latest of the given dates LEAST ( d1, d2, ..., dn ) d1 ... dn = list of dates Earliest of the given dates Try: SELECT SYSDATE(); SELECT LAST_DAY(SYSDATE()); Date Formats Format Code Description Range of Values DD Day of the month 1 - 31 DY Name of the day in 3 uppercase letters SUN, ..., SAT DAY Complete name of the day in uppercase, padded to 9 characters SUNDAY, ..., SATURDAY MM Number of the month 1 - 12 MON Name of the month in 3 uppercase letters JAN, ..., DEC MONTH Name of the month in uppercase padded to a length of 9 characters JANUARY, ..., DECEMBER RM Roman numeral for the month I, ..., XII YY or YYYY Two or four digit year 71 or 1971 HH:MI:SS Hours : Minutes : Seconds 10:28:53 HH 12 or HH 24 Hour displayed in 12 or 24 hour format 1 - 12 or 1 - 24 MI Minutes of the hour 0 - 59 SS Seconds of the minute 0 - 59 AM or PM Meridian indicator AM or PM