# 时间默认值 Joe 写了一个订单表的创建语句: ```postgresql create table orders ( id serial primary key, item_id int, amount int, unit_price money, price money ); ``` 现在,Joe 需要给这个表加入下单时间,即订单写入数据库的时间,那么他应该将这个语句修改为: ## 答案 ```postgresql create table orders ( id serial primary key, item_id int, amount int, unit_price money, price money, ts timestamp default now() ); ``` ## 选项 ### A ```postgresql create table orders ( id serial primary key, item_id int, amount int, unit_price money, price money, ts varchar(16) default now() ); ``` ### B ```postgresql create table orders ( id serial primary key, item_id int, amount int, unit_price money, price money, ts varchar(16) format 'yyyy-mm-dd' ); ``` ### C ```postgresql create table orders ( id serial primary key, item_id int, amount int, unit_price money, price money, ts date default now() ); ``` ### D ```postgresql create table orders ( id serial primary key, item_id int, amount int, unit_price money, price money, ts datetime default now() ); ```