Friday, 16 August 2013

Why doesn't the primary key field exist in a MySQL database when creating a table?

Why doesn't the primary key field exist in a MySQL database when creating
a table?

The exact error I keep seeing is:
Key column 'alarmID' doesn't exist in table
alarmID is my primary key field.
Here is the code I have:
$sql = "CREATE TABLE IF NOT EXISTS alarms (
alaramID INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (alarmID),
Title CHAR(30),
Description TEXT,
DT DATETIME
)";
Note: I am coding in PHP.

No comments:

Post a Comment