SlideShare a Scribd company logo
MySQL
Prepared By: Divya Bothra
Math functions: These are those type of functions that accept
numeric values and after performing the required operation,
return numeric values.
 MOD(): Returns the remainder of one expression by dividing by another
expression.
e.g. SELECT MOD(11,4) “Modulus”;
 POWER()/POW(): Returns the value of one expression raised to the power of
another expression.
e.g. SELECT POWER(3,2) “Power”;
OR, SELECT POW(3,2) “Power”;
 ROUND(): Returns the value of one expression rounded to an integer. It can
also be used to round an expression to a number of decimal points.
e.g. SELECT ROUND(15.193,1) “Round”;
 SIGN(): This function returns sign of a given number.
e.g. SELECT SIGN(-24) “Sign”;
 SQRT(): Returns the non negative square root of numeric expression.
e.g. SELECT SQRT(25) “Square Root”;
 TRUNCATE(): Returns numeric exp1 truncated to exp2 decimal places. If exp2
is 0, then the result will have no decimal point.
e.g. SELECT TRUNCATE(15.79,1) “Truncate”;
Text Functions:
 UCASE()/UPPER(): Converts to Upper Case.
e.g. SELECT UPPER(‘diya’) “Upper Case”;
OR, SELECT UCASE(‘diya’) “Upper Case”;
 LCASE()/LOWER(): Converts to Lower Case.
e.g. SELECT LOWER(‘UDAY’) “Lower Case”;
OR, SELECT LCASE(‘UDAY’) “Lower Case”;
 MID()/SUBSTRING()/SUBSTR(): Returns a substring starting from the specified
position:
e.g. SELECT MID(‘Quadratically’,5,6);
OR, SELECT SUBSTR(‘Quadratically’,5,6);
OR, SELECT SUBSTRING(‘Quadratically’,-5,4);
 LENGTH(): Returns the length of a string in bytes.
e.g. SELECT LENGTH(‘CANDY’) “Length”;
 LEFT(): Returns the leftmost number of characters as specified.
e.g. SELECT LEFT(‘USS/23/67/09’,6);
 RIGHT(): Returns the rightmost number of characters as specified.
e.g. SELECT RIGHT(‘USS/23/67/09’,7);
 INSTR(): Returns the index of the first occurrence of substring.
e.g. SELECT INSTR(‘CORPORATE FLOOR’, ’O’);
 LTRIM(): Removes leading spaces.
e.g. SELECT LTRIM(‘ RDBMS MySQL ‘);
 RTRIM(): Removes trailing spaces.
e.g. SELECT RTRIM(‘ RDBMS MySQL ‘);
 TRIM(): Removes leading and trailing spaces.
e.g. SELECT TRIM(‘ RDBMS MySQL ‘);
Date and Time Functions:
 NOW(): Returns the time at which the function executes.
e.g. SELECT NOW();
 DATE(): Extracts the date part of a date or date-time expression.
e.g. SELECT DATE(‘2020-04-17 01:02:03’);
 MONTH(): Returns the month from the date passed.
e.g. SELECT MONTH(‘2020-05-25’);
 MONTHNAME(): Returns the name of the month.
e.g. SELECT MONTHNAME (‘2020-05-25’);
 DAYNAME(): Returns the name of the weekday.
e.g. SELECT DAYNAME (‘2020-05-25’);
 DAYOFMONTH(): Returns the day of the month (1-31).
e.g. SELECT DAYOFMONTH (‘2020-05-25’);
 DAY(): Returns the day.
e.g. SELECT DAY(‘2020-05-25’);
 YEAR(): Returns the year.
e.g. SELECT YEAR(‘2020-05-25’);
 DAYOFWEEK(): Returns the weekday index of the argument.
e.g. SELECT DAYOFWEEK(‘2020-04-10’);
 DAYOFYEAR(): Returns the day of the year(1-366).
e.g. SELECT DAYOFYEAR(‘2020-04-10’);

More Related Content

PPT
IP Mysql ppt.ppt111212121212121212121212
DOCX
Mysql Functions with examples CBSE INDIA 11th class NCERT
PPT
Chapter-5.ppt
PPTX
Structured query language functions
PPT
Intro to tsql unit 10
ODP
Mysql1
PDF
sql functions3.pdf about the function of sql
PPTX
Built-Functions in MySqll (Advance Database System)
IP Mysql ppt.ppt111212121212121212121212
Mysql Functions with examples CBSE INDIA 11th class NCERT
Chapter-5.ppt
Structured query language functions
Intro to tsql unit 10
Mysql1
sql functions3.pdf about the function of sql
Built-Functions in MySqll (Advance Database System)

Similar to Math, Text, Date Functions of MySQL for Class-12 CBSE (20)

PDF
sql functions3 (1).pdf
PDF
Oracle sql functions
PPTX
Functions
PPTX
Function and types
PPTX
V34 numeric function-c
PPT
Lecture#6 functions in c++
PPTX
12th.pptx
PPTX
MySQL String Functions.pptx
PDF
DP080_Lecture_2 SQL related document.pdf
PDF
SQL Functions and Operators
PPT
ODP
DOCX
Database Query Using SQL_ip.docx
ODP
Mysqlppt
PDF
Foxpro (1)
PPT
Mysql Fun
 
PPTX
Basics of SQL understanding the database.pptx
PPTX
07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE
sql functions3 (1).pdf
Oracle sql functions
Functions
Function and types
V34 numeric function-c
Lecture#6 functions in c++
12th.pptx
MySQL String Functions.pptx
DP080_Lecture_2 SQL related document.pdf
SQL Functions and Operators
Database Query Using SQL_ip.docx
Mysqlppt
Foxpro (1)
Mysql Fun
 
Basics of SQL understanding the database.pptx
07-MIPS-Functions.pptx COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE
Ad

Recently uploaded (20)

PPTX
Lesson notes of climatology university.
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Classroom Observation Tools for Teachers
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
RMMM.pdf make it easy to upload and study
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Sports Quiz easy sports quiz sports quiz
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
Lesson notes of climatology university.
STATICS OF THE RIGID BODIES Hibbelers.pdf
01-Introduction-to-Information-Management.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Cell Types and Its function , kingdom of life
Microbial disease of the cardiovascular and lymphatic systems
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Renaissance Architecture: A Journey from Faith to Humanism
TR - Agricultural Crops Production NC III.pdf
Classroom Observation Tools for Teachers
102 student loan defaulters named and shamed – Is someone you know on the list?
PPH.pptx obstetrics and gynecology in nursing
RMMM.pdf make it easy to upload and study
O7-L3 Supply Chain Operations - ICLT Program
Sports Quiz easy sports quiz sports quiz
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
human mycosis Human fungal infections are called human mycosis..pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
Ad

Math, Text, Date Functions of MySQL for Class-12 CBSE

  • 2. Math functions: These are those type of functions that accept numeric values and after performing the required operation, return numeric values.  MOD(): Returns the remainder of one expression by dividing by another expression. e.g. SELECT MOD(11,4) “Modulus”;  POWER()/POW(): Returns the value of one expression raised to the power of another expression. e.g. SELECT POWER(3,2) “Power”; OR, SELECT POW(3,2) “Power”;
  • 3.  ROUND(): Returns the value of one expression rounded to an integer. It can also be used to round an expression to a number of decimal points. e.g. SELECT ROUND(15.193,1) “Round”;  SIGN(): This function returns sign of a given number. e.g. SELECT SIGN(-24) “Sign”;
  • 4.  SQRT(): Returns the non negative square root of numeric expression. e.g. SELECT SQRT(25) “Square Root”;  TRUNCATE(): Returns numeric exp1 truncated to exp2 decimal places. If exp2 is 0, then the result will have no decimal point. e.g. SELECT TRUNCATE(15.79,1) “Truncate”;
  • 5. Text Functions:  UCASE()/UPPER(): Converts to Upper Case. e.g. SELECT UPPER(‘diya’) “Upper Case”; OR, SELECT UCASE(‘diya’) “Upper Case”;  LCASE()/LOWER(): Converts to Lower Case. e.g. SELECT LOWER(‘UDAY’) “Lower Case”; OR, SELECT LCASE(‘UDAY’) “Lower Case”;
  • 6.  MID()/SUBSTRING()/SUBSTR(): Returns a substring starting from the specified position: e.g. SELECT MID(‘Quadratically’,5,6); OR, SELECT SUBSTR(‘Quadratically’,5,6); OR, SELECT SUBSTRING(‘Quadratically’,-5,4);  LENGTH(): Returns the length of a string in bytes. e.g. SELECT LENGTH(‘CANDY’) “Length”;
  • 7.  LEFT(): Returns the leftmost number of characters as specified. e.g. SELECT LEFT(‘USS/23/67/09’,6);  RIGHT(): Returns the rightmost number of characters as specified. e.g. SELECT RIGHT(‘USS/23/67/09’,7);
  • 8.  INSTR(): Returns the index of the first occurrence of substring. e.g. SELECT INSTR(‘CORPORATE FLOOR’, ’O’);  LTRIM(): Removes leading spaces. e.g. SELECT LTRIM(‘ RDBMS MySQL ‘);
  • 9.  RTRIM(): Removes trailing spaces. e.g. SELECT RTRIM(‘ RDBMS MySQL ‘);  TRIM(): Removes leading and trailing spaces. e.g. SELECT TRIM(‘ RDBMS MySQL ‘);
  • 10. Date and Time Functions:  NOW(): Returns the time at which the function executes. e.g. SELECT NOW();  DATE(): Extracts the date part of a date or date-time expression. e.g. SELECT DATE(‘2020-04-17 01:02:03’);
  • 11.  MONTH(): Returns the month from the date passed. e.g. SELECT MONTH(‘2020-05-25’);  MONTHNAME(): Returns the name of the month. e.g. SELECT MONTHNAME (‘2020-05-25’);
  • 12.  DAYNAME(): Returns the name of the weekday. e.g. SELECT DAYNAME (‘2020-05-25’);  DAYOFMONTH(): Returns the day of the month (1-31). e.g. SELECT DAYOFMONTH (‘2020-05-25’);
  • 13.  DAY(): Returns the day. e.g. SELECT DAY(‘2020-05-25’);  YEAR(): Returns the year. e.g. SELECT YEAR(‘2020-05-25’);
  • 14.  DAYOFWEEK(): Returns the weekday index of the argument. e.g. SELECT DAYOFWEEK(‘2020-04-10’);  DAYOFYEAR(): Returns the day of the year(1-366). e.g. SELECT DAYOFYEAR(‘2020-04-10’);