CSVからSQL INSERTへ
CSVデータからSQLのINSERT文を生成します。CSVエクスポートをデータベースにインポートするのに役立ちます。
INSERT INTO my_table (name, value) VALUES ('A', '1');
INSERT INTO my_table (name, value) VALUES ('B', '2');このツールの使い方
- 1
Type the destination table name into the top field (it is dropped into the generated INSERT exactly as typed).
- 2
Paste your CSV into the text box, keeping the header row first so its names become the column list.
- 3
Read the INSERT statements that appear below as you type, with one statement per data row.
- 4
Select the generated SQL and copy it into your database client or migration script to run it.
CSVからSQL INSERTへとは何ですか?
CSVをデータベースに一括インポートするには、通常INSERT文が必要になります。このジェネレーターは、MySQL、PostgreSQL、SQLiteをはじめ、ほとんどのDBMSで動作する標準SQLのINSERT文を生成します。非常に大きなCSV(1万行を超えるもの)の場合は、データベース付属のネイティブユーティリティ(LOAD DATA / COPY FROM)の方が望ましいでしょう。けた違いに高速です。
よくある活用例
Seeding a few rows of test or fixture data into a local development database without writing the INSERTs by hand.
Converting a small spreadsheet export of lookup values (statuses, categories, country codes) into a migration script.
Drafting INSERT statements for a quick demo or tutorial where the data is short and contains no commas inside fields.
Reshaping a handful of rows copied from a CSV file into SQL you can paste into a query console.
Generating a starting point for a data-load script that you will then hand-edit to add NULLs or fix column types.
Teaching or learning SQL INSERT syntax by watching how column lists and quoted values are assembled from rows.
よくある質問
値に含まれる特殊文字は処理されますか?▼
NULL値はどうなりますか?▼
関連ツール
JSON→CSV変換ツール
オブジェクトのJSON配列をCSV形式に変換します。APIのデータをスプレッドシートにエクスポートするのに最適です。
CSVからJSONへの変換ツール
CSVデータをオブジェクトのJSON配列へ変換します。最初の行はヘッダーとして扱われます。
2進数→16進数変換ツール
2進数を16進数に変換します。同じ値を表すのに、16進数は2進数より4倍コンパクトです。
16進数→2進数変換ツール
16進数を2進数に変換します。各16進数の桁はちょうど4桁の2進数に展開されます。
10進数から2進数への変換ツール
10進数を2進数、16進数、8進数へ、すべての基数に一度に変換します。
ASCII→16進数変換ツール
テキストをASCIIの16進数コードに変換したり、その逆を行ったりします。各文字は2桁の16進数値に変換されます。