Help Center/ GaussDB/ Developer Guide(Distributed_8.x)/ FAQs/ How do I create a column whose default value is the current time?
Updated on 2024-06-03 GMT+08:00

How do I create a column whose default value is the current time?

Answer: When creating a table, set the default value of the column to CURRENT_TIMESTAMP.

gaussdb=# CREATE TABLE tbl (id int, modtime date DEFAULT CURRENT_TIMESTAMP);