I have a database with 3 columns:
id, name, somethingelse
This table has no index set and i am getting "No index defined!" in phpmyadmin
id is a 7digit alphanumeric value, unique to each row.
I want to set Drugid to be the primarykey/index (i dont know the difference if there is one)
Please explain in detail as i am new to this.
Thank you.
This question is related to
mysql
sql
indexing
primary-key
alter table table_name
add constraint myprimarykey primary key(column);
reference : http://www.w3schools.com/sql/sql_primarykey.asp
ALTER TABLE your_table
ADD PRIMARY KEY (Drugid);
Go to localhost/phpmyadmin and press enter key. Now select:
database --> table_name --->Structure --->Action ---> Primary -->click on Primary
If you want to do it with phpmyadmin interface:
Select the table -> Go to structure tab -> On the row corresponding to the column you want, click on the icon with a key
Source: Stackoverflow.com