Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Should I use the datetime or timestamp data type in MySQL?

TIMESTAMP is four bytes vs eight bytes for DATETIME.

Timestamps are also lighter on the database and indexed faster.

The DATETIME type is used when you need values that contain both date and time information. MySQL retrieves and displays DATETIME values in YYYY-MM-DD HH:MM:SS format. The supported range is 1000-01-01 00:00:00 to 9999-12-31 23:59:59. The TIMESTAMP data type has a range of 1970-01-01 00:00:01 UTC to 2038-01-09 03:14:07 UTC. It has varying properties, depending on the MySQL version and the SQL mode the server is running in.

DATETIME is constant while TIMESTAMP is affected by the time_zone setting.
Comment

PREVIOUS NEXT
Code Example
Sql :: sql server concat null 
Sql :: sql 
Sql :: one to many sql 
Sql :: float vs decimal sql 
Sql :: 3rd height salary sql 
Sql :: sqlalchemy _in array sqlite 
Sql :: mysqlimport 
Sql :: execution time of mysql query 
Sql :: with transaction.atomic(): 
Sql :: plpgsql 
Sql :: nested query 
Sql :: identity column in sql server 
Sql :: sql year 
Sql :: get full yearr data omonthwuse sql 
Sql :: on delete set default 
Sql :: varchar2 length in oracle 
Sql :: sqlalchemy get sql 
Sql :: mysql coonect sample code 
Sql :: show blank in column if condition not matches in join mysql 
Sql :: naming conventions postgres index 
Sql :: fetching data from mysqldb 
Sql :: oracle allow space to user 
Sql :: sql multiple into 
Sql :: sql agent jb is enabled query 
Sql :: Character Limitation in sp_executesql sql server 
Sql :: sql equal then arrow 
Sql :: nuget sqllite-net-pcl 
Sql :: edit a field mysql terminal 
Sql :: my sql data file extention 
Sql :: date query 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =