0

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

0

1 Answer 1

4

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,
Sign up to request clarification or add additional context in comments.

1 Comment

You've got the two backward - OP needs to replace (0) with 0. --edit There you go :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.