Reputation: 316
I want to set the default value in a TIME column in a MySQL DB table to be '08:00:00' regardless of timezone. I can't quite figure out the syntax.
create table venues (venue_id SERIAL PRIMARY KEY, name VARCHAR(100), address VARCHAR(250), open_time TIME DEFAULT '08:00:00'::TIME, close_time TIME DEFAULT '20:00:00'::TIME, activities VARCHAR(250);
It has a problem with how i'm trying to set the default values for the two TIME columns. I also tried using '08:00:00'::time without time zone
Upvotes: 0
Views: 226
Reputation: 164679
'08:00:00'::TIME
is how you do a type cast in Postgres, not MySQL. MySQL uses the SQL standard cast
. Similarly time without time zone
is a Postgres type.
You don't need a type cast at all, MySQL (and Postgres) will cast it to the column type.
create table venues (
venue_id SERIAL PRIMARY KEY,
name VARCHAR(100),
address VARCHAR(250),
open_time TIME DEFAULT '08:00:00',
close_time TIME DEFAULT '20:00:00',
activities VARCHAR(250)
);
Upvotes: 1