DB(Database)/MySQL
[MySQL] ๋์ฉ๋ ํ ์ด๋ธ csv, txt ํ์ผ ํํ๋ก ๋ด๋ณด๋ด๊ธฐ & ๋ถ๋ฌ์ค๊ธฐ
ํฑ์ ค
2021. 2. 9. 11:29
txt ํ์ผ๋ก ๋ด๋ณด๋ด๊ธฐ
select *
from [ํ
์ด๋ธ๋ช
]
into outfile '[ํ์ผ๋ช
].txt' character set utf8mb4
fields terminated by ',', optionally enclosed by '"'
escaped by '\\'
lines terminated by '\n';
csv ํ์ผ๋ก ๋ด๋ณด๋ด๊ธฐ
select *
from [ํ
์ด๋ธ๋ช
]
into outfile '[ํ์ผ๋ช
].csv' character set utf8mb4
fields terminated by ',', optionally enclosed by '"'
escaped by '\\'
lines terminated by '\n';
txt ํ์ผ ํ ์ด๋ธ๋ก ์ฝ์ด์ค๊ธฐ
load data infile '[ํ์ผ๋ช
].txt'
into table [ํ
์ด๋ธ๋ช
] character set utf8mb4
fields terminated by ','
enclosed by '"'
lines terminated by '\n';
-- ignore 1 rows; -- ์ด ์ด๋ฆ ๋ฌด์ํ๊ณ ํ
์ด๋ธ์ ํ ์ ์ฅํ๊ธฐ (์ฒซ ์ค ๋ฌด์)
csv ํ์ผ ํ ์ด๋ธ์ ์ฝ์ด์ค๊ธฐ
load data infile '[ํ์ผ๋ช
].csv'
into table [ํ
์ด๋ธ๋ช
] character set utf8mb4
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
ignore 1 rows; -- ์ด ์ด๋ฆ ๋ฌด์ํ๊ณ ํ
์ด๋ธ์ ํ ๊ฐ์ ธ์ค๊ธฐ (์ฒซ ์ค ๋ฌด์)
728x90