Skip to content

DATETIME DEFAULT CURRENT_TIMESTAMP #28

Description

@tithonus163

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>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions