What is the difference between an index and a primary key in PHPMyAdmin?

In PHPMyAdmin, an index is used to improve the speed of data retrieval from a table by creating an ordered list of values based on one or more columns. On the other hand, a primary key is a unique identifier for each row in a table, and it enforces the uniqueness and non-null constraints on the specified column(s). While an index can be created on any column(s) to improve query performance, a primary key is specifically used to uniquely identify each row in a table.

// Create an index on a column in PHPMyAdmin
CREATE INDEX index_name ON table_name(column_name);

// Create a primary key on a column in PHPMyAdmin
ALTER TABLE table_name ADD PRIMARY KEY (column_name);