Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs

MySQL PERIOD_DIFF Function

by suresh

MySQL PERIOD_DIFF function is one of the MySQL Date Functions, which returns the total number of months between Period 1 and 2. This PERIOD_DIFF function accepts the arguments in YYYYMM or YYMM formats only. The basic syntax of the PERIOD_DIFF() Function in MySQL is as shown below:

PERIOD_DIFF(Period1, Period2);

MySQL PERIOD_DIFF function Example

This MySQL Period difference function accepts either the YYMM or YYYYMM format value as an argument value.

The following Date Function examples help you understand the use of this MySQL Period diff function. In this MySQL example, we are finding the total number of months between different dates.

SELECT PERIOD_DIFF(201608, 201602);

SELECT PERIOD_DIFF(201608, 201209);

SELECT PERIOD_DIFF(7508, 7609);
MySQL PERIOD_DIFF Function 1

Placed Under: MySQL

  • How to Download MySQL
  • Install MySQL on Windows
  • MySQL Create Database
  • MySQL Delete Database
  • MySQL Create Table
  • MySQL Drop Table
  • MySQL SELECT Statement
  • MySQL ALIAS Column
  • MySQL Distinct
  • MySQL Insert Statement
  • MySQL Delete
  • MySQL Truncate Table
  • MySQL WHERE Clause
  • MySQL Order By
  • MySQL Group By
  • MySQL Having Clause
  • MySQL LIMIT
  • MySQL Arithmetic Operators
  • MySQL COALESCE Function
  • MySQL AND Operator
  • MySQL NOT Operator
  • MySQL OR Operator
  • MySQL XOR Operator
  • MySQL BETWEEN Operator
  • MySQL Not Between Operator
  • MySQL GREATEST Function
  • MYSQL LEAST Function
  • MySQL LIKE Operator
  • MySQL NOT LIKE Operator
  • MySQL IFNULL Operator
  • MySQL NULLIF Operator
  • MySQL INTERVAL Operator
  • MySQL IS Operator
  • MySQL IN Operator
  • MySQL NOT IN Operator
  • MySQL IS NOT NULL
  • MySQL IS NULL
  • MySQL Inner Join
  • MySQL Cross Join
  • MySQL Right Join
  • MySQL Left Join
  • MySQL Aggregate Functions
  • MySQL Date Functions
  • MySQL Date Function
  • MySQL String Functions
  • MySQL Numeric Functions

Copyright © 2021 · All Rights Reserved by Suresh

About Us | Contact Us | Privacy Policy