SQL Error when creating a table

Bogdan Constantin

I have a problem when I run this SQL query:

 CREATE TABLE `softwaredb`.`profile`
    ( `id` INT(11) NOT NULL AUTO_INCREMENT ,
     `user_id` INT(11) NOT NULL ,
     `gender` VARCHAR(255) NOT NULL , 
    `height` INT(4) NOT NULL ,
     `weight` INT(4) NOT NULL ,
     `bodytype` INT(1) NOT NULL )

The error I keep running into is the following:

Incorrect table definition;
there can be only one auto column and it must be defined as a key

Sachu

Try this

CREATE TABLE `softwaredb`.`profile`
( `id` INT(11) NOT NULL AUTO_INCREMENT ,
 `user_id` INT(11) NOT NULL ,
 `gender` VARCHAR(255) NOT NULL , 
`height` INT(4) NOT NULL ,
 `weight` INT(4) NOT NULL ,
 `bodytype` INT(1) NOT NULL ,
primary key (id) //specify id as primary key will sort out the error..try
) 

OR Try

CREATE TABLE `softwaredb`.`profile`
    ( `id` INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT ,
     `user_id` INT(11) NOT NULL ,
     `gender` VARCHAR(255) NOT NULL , 
    `height` INT(4) NOT NULL ,
     `weight` INT(4) NOT NULL ,
     `bodytype` INT(1) NOT NULL 
    ) 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error creating table in SQL

From Dev

SQL: error when creating a foreign table that has an enum column

From Dev

SQL, Why do I get this error when creating the reports table?

From Dev

error when creating a partitioned table

From Dev

error when creating table in hive

From Dev

SQL Syntax Error Creating Table

From Dev

MySQL error #1064 when creating table

From Dev

Adding Index when Creating a Table Error 1064

From Dev

Error when creating MySQL Table with PDO

From Dev

#1089 Error when creating table in phpMyAdmin

From Dev

Error when creating table with mysqldb module

From Dev

MySQL error when creating table with phpmyadmin #1016

From Dev

JSP & MySQL | Error when creating table

From Dev

Error when creating a pivot table using VBA

From Dev

error in SQL syntax creating a database table

From Dev

Having an error in sql while creating table

From Dev

SQL - "Default" when creating a table - is it neccessary?

From Dev

SQL showing an error when creating table with columns that have the data type longtext

From Dev

SQL Error: ORA-00907: missing right parenthesis when trying to creating table

From Dev

SQL syntax error in mysql when creating trigger

From Dev

Error when creating a table in SQLite database with composite primary key at AUTOINCREMENT

From Dev

MySQL Error Number 150 when creating Table with Foreign Key

From Dev

Foreign key error when creating table (errno 150)

From Dev

Error when creating lua table from inside the c api

From Dev

R colnames/rownames error when creating table by hand

From Dev

Creating a password recovery table - Error when inserting a value

From Dev

My sql error in creating temporaty table stored procedure

From Dev

SQL query error of creating and inserting a table at the same time

From Dev

What cause SQL syntax error in creating table in database

Related Related

  1. 1

    Error creating table in SQL

  2. 2

    SQL: error when creating a foreign table that has an enum column

  3. 3

    SQL, Why do I get this error when creating the reports table?

  4. 4

    error when creating a partitioned table

  5. 5

    error when creating table in hive

  6. 6

    SQL Syntax Error Creating Table

  7. 7

    MySQL error #1064 when creating table

  8. 8

    Adding Index when Creating a Table Error 1064

  9. 9

    Error when creating MySQL Table with PDO

  10. 10

    #1089 Error when creating table in phpMyAdmin

  11. 11

    Error when creating table with mysqldb module

  12. 12

    MySQL error when creating table with phpmyadmin #1016

  13. 13

    JSP & MySQL | Error when creating table

  14. 14

    Error when creating a pivot table using VBA

  15. 15

    error in SQL syntax creating a database table

  16. 16

    Having an error in sql while creating table

  17. 17

    SQL - "Default" when creating a table - is it neccessary?

  18. 18

    SQL showing an error when creating table with columns that have the data type longtext

  19. 19

    SQL Error: ORA-00907: missing right parenthesis when trying to creating table

  20. 20

    SQL syntax error in mysql when creating trigger

  21. 21

    Error when creating a table in SQLite database with composite primary key at AUTOINCREMENT

  22. 22

    MySQL Error Number 150 when creating Table with Foreign Key

  23. 23

    Foreign key error when creating table (errno 150)

  24. 24

    Error when creating lua table from inside the c api

  25. 25

    R colnames/rownames error when creating table by hand

  26. 26

    Creating a password recovery table - Error when inserting a value

  27. 27

    My sql error in creating temporaty table stored procedure

  28. 28

    SQL query error of creating and inserting a table at the same time

  29. 29

    What cause SQL syntax error in creating table in database

HotTag

Archive