Gara-gara udah lama tidak bermain MySQL gw dibuat pusing dengan sebuah field yang bernama “group”, query gw dianggap salah, padahal semestinya tidak.

mysql> load data local infile ‘Member.csv’ into table idsl.user fields terminated by ‘,’ enclosed by ‘”‘ lines terminated by ‘\n’
-> (email,nickname,group);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘group)’ at line 2

mysql>

Setelah nama fieldnya diganti ternyata aman-aman sahaja🙂

mysql> load data local infile ‘Member.csv’ into table idsl.user fields terminated by ‘,’ enclosed by ‘”‘ lines terminated by ‘\n’
-> (email,nickname,type);
Query OK, 118 rows affected, 2 warnings (0.05 sec)
Records: 118 Deleted: 0 Skipped: 0 Warnings: 0

mysql>

Kira-kira apa penyebabnya ditolaknya query diatas? apa karena group (GROUP BY) adalah salah satu fungsi MySQL? Semestinya sah-sah saja dong gw menamakan field gw dng nama group.
Hasil googling ternyata ada juga yang mengalami hal sama🙂

Bodo ah lanjut koding lagi.