Comments - Table Construction
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
The error message tells you where the error is. There's no need for
(EvaluatorNum)
afterPRIMARY KEY
since you've already given the field name earlier in the statement.CREATE TABLE EmployeeEvals (EmployeeNum INT(7) NOT NULL, Grade ENUM("PR", "SA", "UN", "VG", "EX"), Comment TEXT, EvaluatorNum INT(7) NOT NULL AUTO_INCREMENT PRIMARY KEY); Query OK, 0 rows affected (0.023 sec)
rwilson7 [Final6];LOAD DATA INFILE 'EmployeeEvals.csv' INTO TABLE EmployeeEvals -> FIELDS TERMINATED BY ',' -> ENCLOSED BY '"' -> LINES TERMINATED BY '\r\n' -> IGNORE 1 LINES; ERROR 1062 (23000): Duplicate entry '2' for key 'PRIMARY'
A primary key must be unique. This error means there are duplicate values for that field in the csv, which is not permitted according to your table definition. See Getting Started with Indexes. Also, check the csv data carefully. If your Comment field has commas in the text, this may be read as a field terminator, so these need to be escaped.
I did that and thank you very much. However I still got that error message after trying to load a csv file into the table.