LOAD DATA

Description

The LOAD DATA statement reads rows from a csv file into a table at a very high speed.

Syntax

  1. > LOAD DATA
  2. INFILE 'file_name'
  3. INTO TABLE tbl_name
  4. [{FIELDS | COLUMNS}
  5. [TERMINATED BY 'string']
  6. [[OPTIONALLY] ENCLOSED BY 'char']
  7. [ESCAPED BY 'char']
  8. ]
  9. [LINES
  10. [STARTING BY 'string']
  11. [TERMINATED BY 'string']
  12. ]
  13. [IGNORE number {LINES | ROWS}]
  • TERMINATED BY, ENCLOSED BY, and other separators in meanings are the same as SELECT INTO.

  • The IGNORE number LINES clause can be used to ignore lines at the start of the file. For example, you can use IGNORE 1 LINES to skip an initial header line containing column names:

  1. LOAD DATA INFILE '/tmp/test.txt' INTO TABLE test IGNORE 1 LINES;

Examples

The SSB Test is an example of LOAD DATA syntax. Complete a SSB Test with MatrixOne

  1. > LOAD DATA INFILE '/ssb-dbgen-path/lineorder_flat.tbl ' INTO TABLE lineorder_flat;

Constraints

Only CSV format file is supported for now.