LOAD DATA

语法说明

LOAD DATA语句以超快的速度从一个文本文件中读取数据然后存储到表中。

语法结构

  1. > LOAD DATA
  2. [LOW_PRIORITY | CONCURRENT] [LOCAL]
  3. INFILE 'file_name'
  4. [REPLACE | IGNORE]
  5. INTO TABLE tbl_name
  6. [PARTITION (partition_name [, partition_name] ...)]
  7. [CHARACTER SET charset_name]
  8. [{FIELDS | COLUMNS}
  9. [TERMINATED BY 'string']
  10. [[OPTIONALLY] ENCLOSED BY 'char']
  11. [ESCAPED BY 'char']
  12. ]
  13. [LINES
  14. [STARTING BY 'string']
  15. [TERMINATED BY 'string']
  16. ]
  17. [IGNORE number {LINES | ROWS}]
  18. [(col_name_or_user_var
  19. [, col_name_or_user_var] ...)]
  20. [SET col_name={expr | DEFAULT}
  21. [, col_name={expr | DEFAULT}] ...]

* TERMINATED BYENCLOSED BY等分隔符的意义与SELECT INTO一致。 * IGNORE number可用来忽略从文件开始的第number行/列。

示例

可以在SSB测试中了解LOAD DATA语句的用法,请见 Complete a SSB Test with MatrixOne

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