Skip to content

Instantly share code, notes, and snippets.

@thesuhu
Created May 29, 2023 14:45
Show Gist options
  • Save thesuhu/74e9d19d4d61b415ff972cf6af97c5a2 to your computer and use it in GitHub Desktop.
Save thesuhu/74e9d19d4d61b415ff972cf6af97c5a2 to your computer and use it in GitHub Desktop.
MySQL - Import CSV File with LOCAL INFILE
LOAD DATA LOCAL INFILE 'g:\\temp\\file1.csv'
INTO TABLE mytable
FIELDS TERMINATED BY ';' -- Pemisah kolom dalam file CSV
ENCLOSED BY '"' -- Karakter penutup untuk kolom yang diapit oleh tanda kutip ("")
LINES TERMINATED BY '\r\n' -- Karakter akhir baris dalam file CSV
IGNORE 1 LINES -- Mengabaikan baris header pertama dalam file CSV (jika ada)
-- Kolom target dalam tabel
(COL1, COL2, COL3, COL4, COL5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment