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
    • Python Programs
    • Java Programs
    • SQL FAQ’s

MySQL Second Function

by suresh

MySQL Second function is one of the MySQL Date Functions, which returns the Seconds value from a given time. This Second function returns integer value range from 0 to 59.

The basic syntax of the Second() Function in MySQL is as shown below:

SECOND(Time or expression);

MySQL Second function Example

The below shown queries help you understand the use of this Second function. In this instance, we are returning the Second value from the different time expression, and the Datetime expression.

SELECT SECOND('10:22:45');

SELECT SECOND('2019-02-05 10:20:12');

SELECT SECOND('2019-02-05 10:20:59.112352');

OUTPUT

MySQL Second Function 1

Second Function Example 2

In this Date Function example, we are returning Seconds value from the current date and time returned by the Now() function, UTC_TIME function, and UTC_TIMESTAMP function.

SELECT NOW(), SECOND(NOW());

SELECT UTC_TIME(), SECOND(UTC_TIME());

SELECT UTC_TIMESTAMP(), SECOND(UTC_TIMESTAMP());

OUTPUT

MySQL Second Function 2

Here, we are trying to return the seconds value from String DateTime format, HHMMSS formats. Within the last MySQL statement, we used the zero hour part as an input.

SELECT NOW(), SECOND(NOW() + 10);  

SELECT SECOND(101235);

SELECT SECOND('00:12:22');

OUTPUT

MySQL Second Function 3

MySQL Second Example 3

In this example, we show you how to use this Second function on table data. Here, we are returning the seconds value from the Hire Date column.

SELECT EmpID,
FirstName,
LastName,
Occupation,
YearlyIncome,
Sales,
HireDate,
SECOND(HireDate)
FROM `MySQL Tutorial`.customer;

OUTPUT

MySQL Second Function 4

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
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy