0
CREATE TABLE  `surfkid-db`.`Channels` (`name` VARCHAR( 30 ) NOT NULL ,`commercial` BOOL( 1 ) NOT NULL DEFAULT  '0' AUTO_INCREMENT ,`usrid` INT( 5 ) NOT NULL DEFAULT  '0' AUTO_INCREMENT ,`id` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE = MYISAM ;

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 '(1) NOT NULL DEFAULT '0' AUTO_INCREMENT, `usrid` INT(5) NOT NULL DEFAULT '0' AUT' at line 1 

I Couldn`t provide to error message, sorry please help

1
  • 2
    You might start with determining how, exactly, a BOOL value should be auto incremented.. Commented Oct 13, 2010 at 18:26

2 Answers 2

4

I believe that only INTs can be AUTO_INCREMENT, and I'm fairly sure that only the primary key can be auto-incremented.

Sign up to request clarification or add additional context in comments.

Comments

1

You don't need specify size for BIT and INT fields, also AUTO_INCREMENT does not apply to BOOL. Try this instead:

CREATE TABLE  `surfkid-db`.`Channels` 
(
  `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` VARCHAR(30) NOT NULL ,
  `commercial` BOOL NOT NULL DEFAULT  0,
  `usrid` INT NOT NULL DEFAULT  0
)

Comments

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.