SQL - TIME data type

Data System Architecture

About

The time data type is a SQL data type that represents the time part of a instant. ie TIME contains the <datetime field>s HOUR, MINUTE, and SECOND.

Syntax

The ANSI syntax is:

TIME [ <left paren> <time precision> <right paren> ] [ WITH TIME ZONE ]
  • If <time precision> is not specified, then 0 is implicit.
  • The length of a TIME is 8 positions plus the <time fractional seconds precision>, plus 1 position if the <time fractional seconds precision> is greater than 0.
  • The length of a TIME WITH TIME ZONE is 14 positions plus the <time fractional seconds precision> plus 1 position if the <time fractional seconds precision> is greater than 0.
  • TIME(P), where P is the number of digits in <seconds fraction>, if specified, and 0 otherwise.
  • The data type of a <time literal> that specifies <time zone interval> is TIME(P) WITH TIME ZONE, where P is the number of digits in <seconds fraction>, if specified, and 0 otherwise.
  • A TIME that does not specify WITH TIME ZONE has an implicit time zone equal to the local time zone for the SQL session.





Discover More
Data System Architecture
SQL - Data Type (Column Type)

The Data Type of a column in SQL. They are defined in the ANSI/ISO SQL standard but may vary from sql engine (database) to another. The below table shows you the history of the data type in the ANSI...



Share this page:
Follow us:
Task Runner