SQL Keywords

SQL MINUTE_MICROSECOND

What is SQL MINUTE_MICROSECOND in MySQL date arithmetic?

Combined interval unit that represents minutes, seconds, and microseconds for MySQL date and time arithmetic.
Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Compatible dialects for SQL MINUTE_MICROSECOND: Supported: MySQL, MariaDB Not supported: PostgreSQL, SQL Server, Oracle, SQLite

SQL MINUTE_MICROSECOND Full Explanation

MINUTE_MICROSECOND is one of MySQL’s composite interval keywords. It is used in expressions such as DATE_ADD, DATE_SUB, TIMESTAMPADD, and TIMESTAMPDIFF to add to, subtract from, or compare DATETIME, TIMESTAMP, and TIME values with precision down to microseconds. The literal that precedes the unit contains minutes, seconds, and fractional seconds formatted as 'MM:SS.MMMMMM'. When executed, MySQL converts the literal into an exact interval and applies it to the left-hand date or time expression. If the literal is malformed or the host column type does not support microseconds, MySQL raises an error or silently truncates the fraction part, depending on sql_mode settings.

SQL MINUTE_MICROSECOND Syntax

-- Generic usage
<date_or_time_expr> {+|-} INTERVAL <expr> MINUTE_MICROSECOND;

-- Stand-alone interval
INTERVAL <expr> MINUTE_MICROSECOND

SQL MINUTE_MICROSECOND Parameters

  • expr (STRING or NUMERIC) - Interval value formatted as 'MM|||SS.MMMMMM' (minutes 0-59, seconds 0-59, microseconds 0-999999)

Example Queries Using SQL MINUTE_MICROSECOND

-- Add 2 minutes, 15.250000 seconds to the current timestamp
SELECT NOW() + INTERVAL '02:15.250000' MINUTE_MICROSECOND;

-- Subtract a minute-microsecond interval from a column
UPDATE video_encodes
SET  started_at = started_at - INTERVAL '00:30.000500' MINUTE_MICROSECOND
WHERE status = 'queued';

-- Difference between two times in minute-microsecond units
SELECT TIMESTAMPDIFF(MINUTE_MICROSECOND,
                     start_time,
                     end_time) AS encode_duration
FROM   video_encodes;

Expected Output Using SQL MINUTE_MICROSECOND

  • First query returns a TIMESTAMP exactly 2 minutes 15
  • 25 seconds ahead of NOW()
  • Second query moves queued jobs back by 30
  • 0005 seconds
  • Third query returns the duration of each encode as an integer where the left digits represent minutes and the right six digits represent microseconds

Use Cases with SQL MINUTE_MICROSECOND

  • Precise scheduling or timeout calculations where sub-second accuracy is required.
  • Measuring execution time of short-running jobs or events.
  • Adjusting timestamps for logging, media processing, IoT data, or financial tick data that demands microsecond resolution.

Common Mistakes with SQL MINUTE_MICROSECOND

  • Supplying only minutes and microseconds (missing seconds) – always include seconds.
  • Exceeding valid ranges (e.g., '61:00.000000') – minutes and seconds must be 0-59.
  • Forgetting the fractional part delimiter '.' – use a period between seconds and microseconds.
  • Using the keyword in databases other than MySQL/MariaDB – most do not recognize it.

Related Topics

INTERVAL, SECOND_MICROSECOND, MINUTE_SECOND, DATE_ADD, DATE_SUB, TIMESTAMPDIFF, TIMESTAMPADD

First Introduced In

MySQL 4.1

Frequently Asked Questions

What format does MINUTE_MICROSECOND expect?

A string formatted as 'MM:SS.MMMMMM' where MM and SS are zero-padded 0-59 and MMMMMM is a six-digit microsecond value.

Can I use MINUTE_MICROSECOND without the fractional part?

Yes. You may supply 'MM:SS' or append a '.0'. MySQL will treat the microseconds as zero.

Does PostgreSQL support MINUTE_MICROSECOND?

No. PostgreSQL lacks composite interval units. Combine separate minute and second intervals instead.

How do I preserve microseconds in a DATETIME column?

Define the column with fractional seconds precision, for example DATETIME(6), to store six-digit microseconds.

Sign up to get up to date news on SQL keywords
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.
Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo

Check out other commonly used SQL Keywords!