Reputation: 45
I dont know SQL, but I need to use it for PHP, and I have a problem. When I try to create this table:
CREATE TABLE logs (
userbeinglogged VARCHAR(255) NOT NULL,
action_location VARCHAR(255) NOT NULL,
log_date DATE('YYYY-MM-DD') NOT NULL,
log_time TIME('00:00:00') NOT NULL,
);
At the last line, I get the error "A closing bracket was expected (near')')"
.
I don't see the problem. Also, I'm pretty sure the DATE
and TIME
functions are incorrect, so if you could help me out with the syntax of those that would help too.
Upvotes: 0
Views: 47
Reputation: 3618
Remove your comma, right before the closing parenthesis.
And for advice just use log_Date DATETIME
Upvotes: 1
Reputation: 11648
You have a trailing comma. Change it to this.
CREATE TABLE logs (
userbeinglogged VARCHAR(255) NOT NULL,
action_location VARCHAR(255) NOT NULL,
log_date DATE('YYYY-MM-DD') NOT NULL,
log_time TIME('00:00:00') NOT NULL
);
Upvotes: 1
Reputation: 7102
Remove the last comma. Looks like it has an extra.
CREATE TABLE logs ( userbeinglogged VARCHAR(255) NOT NULL, action_location VARCHAR(255) NOT NULL, log_date DATE('YYYY-MM-DD') NOT NULL, log_time TIME('00:00:00') NOT NULL);
Upvotes: 1