I am going to create a table with a column that stores a Created_date file that has a datetime data type. And my goal is to set the default as sysdate ().
I tried
CREATE TABLE tbl_table( created_datedatetime DEFAULT sysdate ())
tbl_table
created_date
This gives me an error saying that this is not a valid default instruction. I used the same logic in Oracle. Please help me solve this problem.
Thanks in advance.
Try CREATE TABLE tbl_table ( created_date TIMESTAMP DEFAULT NOW())
CREATE TABLE tbl_table ( created_date TIMESTAMP DEFAULT NOW())
But: NOWdifferent from sysdateand TIMESTAMPdifferent from datetime, remember this.
NOW
sysdate
TIMESTAMP
datetime
. TIMESTAMP - , , NOW(). . MySQL Bugtracker.
NOW()