0

I tried to create a table as following in phpmyadmin. But it gives this error:

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

create table itemList (
    uid varchar(15),
    item_Id int AUTO_INCREMENT,
    item_Name varchar(50) not null,
    PRIMARY key (uid, item_Id)
);

Someone please help me.

MSRK
  • 5
  • 3
user123
  • 11
  • 1
  • you con not do that in mysql. How ever you can have composite key – binu.py Jun 02 '16 at 05:46
  • 1
    phpMyAdmin is an application that helps you manage MySQL and MariaDB databases; it's not a database itself. You'll probably get better or more specific help if you instead tag the database platform you're using. – Isaac Bennetch Jun 02 '16 at 14:11
  • 1
    You need an additional index on `(item_id)`. this because that column is defined with the `auto_increment` property. Unrelated to the primary key. – ypercubeᵀᴹ Jun 04 '16 at 13:05
  • 3
    Possible duplicate of [MySQL: #1075 - Incorrect table definition; autoincrement vs another key?](http://stackoverflow.com/questions/8114535/mysql-1075-incorrect-table-definition-autoincrement-vs-another-key) – ypercubeᵀᴹ Jun 04 '16 at 13:07

0 Answers0