-
Notifications
You must be signed in to change notification settings - Fork 27
Description
DATETIME DEFAULT CURRENT_TIMESTAMP
mysql> select version();
+------------+
| version() |
+------------+
| 5.7.34-log |
+------------+
1 row in set (0.00 sec)
mysql>
mysql> CREATE TABLE example (
-> id INT AUTO_INCREMENT PRIMARY KEY,
-> name VARCHAR(50),
-> created_at DATETIME DEFAULT sysdate
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sysdate
)' at line 4
mysql> CREATE TABLE example (
-> id INT AUTO_INCREMENT PRIMARY KEY,
-> name VARCHAR(50),
-> created_at DATETIME DEFAULT now
-> );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'now
)' at line 4
mysql> CREATE TABLE example (
-> id INT AUTO_INCREMENT PRIMARY KEY,
-> name VARCHAR(50),
-> created_at DATETIME DEFAULT CURRENT_TIMESTAMP
-> );
Query OK, 0 rows affected (0.05 sec)
mysql>