Mysql

  • balko
  • Beginner
  • Beginner
  • balko
  • Posts: 39
  • Loc: Lancaster, Pa

Post 3+ Months Ago

Yeah, I was trying to add a table in phpmyadmin and I got this when i hit save


Code: [ Select ]
Error

SQL-query : 

CREATE TABLE `Blog` (

`entryID` SMALLINT( 4 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`entrydate` DATETIME NOT NULL ,
`headline` VARCHAR( 50 ) ,
`entry` TEXT NOT NULL ,
INDEX ( `headline` )
)

MySQL said:


#1075 - Incorrect table definition; There can only be one auto column and it must be defined as a key
  1. Error
  2. SQL-query : 
  3. CREATE TABLE `Blog` (
  4. `entryID` SMALLINT( 4 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
  5. `entrydate` DATETIME NOT NULL ,
  6. `headline` VARCHAR( 50 ) ,
  7. `entry` TEXT NOT NULL ,
  8. INDEX ( `headline` )
  9. )
  10. MySQL said:
  11. #1075 - Incorrect table definition; There can only be one auto column and it must be defined as a key



What does it mean & how do i fix it?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • balko
  • Beginner
  • Beginner
  • balko
  • Posts: 39
  • Loc: Lancaster, Pa

Post 3+ Months Ago

so is there any help?
  • steve101
  • Beginner
  • Beginner
  • steve101
  • Posts: 35

Post 3+ Months Ago

PHP Code: [ Select ]
CREATE TABLE `Blog` (
 
`entryID` SMALLINT( 4 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
 
`entrydate` DATETIME NOT NULL ,
 
`headline` VARCHAR( 50 ) ,
 
`entry` TEXT NOT NULL ,
 
PRIMARY KEY(`entryID`),
 
INDEX ( `headline` )
 
)
  1. CREATE TABLE `Blog` (
  2.  
  3. `entryID` SMALLINT( 4 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
  4.  
  5. `entrydate` DATETIME NOT NULL ,
  6.  
  7. `headline` VARCHAR( 50 ) ,
  8.  
  9. `entry` TEXT NOT NULL ,
  10.  
  11. PRIMARY KEY(`entryID`),
  12.  
  13. INDEX ( `headline` )
  14.  
  15. )


You need to make the auto-increcement table a primary key - that should work (above) I've tried it.

Steve!
  • Tannu4u
  • Proficient
  • Proficient
  • User avatar
  • Posts: 480
  • Loc: India

Post 3+ Months Ago

yes steve101 is correct u can try this because a column can be an auto increment only when its a key.U can get a very - very useful tool named MySql front.it will help u a lot.u can get it from the site

http://www.mysqlfront.com

i think so or u may search......

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 54 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.