Reputation: 643
I'm sort of confused here, what is wrong with my syntax?
CREATE TABLE `users` (
`userId` int(7) NOT NULL AUTO_INCREMENT,
`firstName` varchar(30) NOT NULL,
`lastName` varchar(30) NOT NULL,
`gender` varchar(1) NOT NULL,
`birthday` datetime NOT NULL,
`city` varchar(20) NOT NULL,
`province` varchar(20) NOT NULL,
`postalCode` varchar(6) NOT NULL,
`country` varchar(20) NOT NULL,
`email` varchar(30) NOT NULL,
`password` varchar(32) NOT NULL,
`bio` text NOT NULL,
`active` int(1) NOT NULL DEFAULT(0),
PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
This was auto generated from an SQL export. It gives the following error:
#1064
- 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 '(0), PRIMARY KEY (userId
) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCR' at line 14
Upvotes: 0
Views: 69
Reputation: 40318
Specifying the default value is wrong.There is no need of braces
Replace
`active` int(1) NOT NULL DEFAULT (0),
with
`active` int(1) NOT NULL DEFAULT 0,
Upvotes: 4