I am trying to import the hotel table into the database. However, it seems I get an error that I cannot fix it spending hours! Here's the error I am getting:
Incorrect integer value: 'wolfinns1' for column 'hotelId' at row 1
The first columns in auto_increment, but it seems it attempts to read from the cvs file although there is no entries there! Here are the records for the hotels table and sql commands. By the way, I have converted all the files to Unix format.
==== hotesls.csv =============
wolfinns1,midas1st,Fayetteville,NC,9101231234,14
wolfinns2,midas2st,Raleigh,NC,9191231234,15
wolfinns3,midas3st,Los Angeles,CA,3101231234,16
wolfinns4,midas4st,New York,NY,2121231234,17
==========================
Here is the schema:
+-----------+-----------------+------+-----+---------+------------
| Field | Type | Null | Key | Default | Extra
+-----------+-----------------+------+-----+---------+------------
| hotelId | int(9) unsigned | NO | PRI | NULL | auto_increment
| name | varchar(50) | NO | | NULL |
| address | varchar(75) | NO | | NULL |
| city | varchar(50) | NO | | NULL |
| state | char(2) | NO | | NULL |
| phone | varchar(20) | NO | UNI | NULL |
| managerId | int(9) unsigned | NO | MUL | NULL |
+-----------+-----------------+------+-----+---------+------------
Now issuing the sql command:
MariaDB [xzheng6]> LOAD DATA LOCAL INFILE 'hotels.csv' INTO TABLE hotels FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STARTING BY '';
Query OK, 0 rows affected, 16 warnings (0.00 sec)
Records: 4 Deleted: 0 Skipped: 4 Warnings: 16
Here are the warnings!
MariaDB [xzheng6]> show warnings\g
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1366 | Incorrect integer value: 'wolfinns1' for column 'hotelId' at row 1 |
| Warning | 1265 | Data truncated for column 'state' at row 1 |
| Warning | 1261 | Row 1 doesn't contain data for all columns
Thank you very much in advance. CS