The TERMINATED BY clause appears inside bulk-data commands such as LOAD DATA INFILE (MySQL), COPY (PostgreSQL), and CREATE TABLE ... ROW FORMAT DELIMITED (Hive). It tells the database which byte or string marks the end of each field or line in a text file. By overriding the default delimiter (often a tab or comma) you can import or export pipe-delimited, semicolon-delimited, or other custom formats without post-processing.There are usually two flavors:1. FIELDS TERMINATED BY - delimiter between individual column values2. LINES TERMINATED BY - delimiter between recordsMany dialects let you combine TERMINATED BY with ENCLOSED BY or ESCAPED BY for more precise parsing. The clause is not part of the ANSI SQL standard, so exact syntax and supported escape sequences vary by engine. Always consult the dialect documentation when moving scripts between systems.
delimiter_string
(string) - One or more characters designating the boundary between fields or lines.scope
(enum) - Either FIELDS or LINES, indicating whether the delimiter separates columns or records.MySQL 3.23 (1999)
Any printable character or escape sequence that does not appear inside your data values. Common choices include comma (,), pipe (|), tab (\t), and semicolon (;).
No. SQL Server uses BULK INSERT with the FIELDTERMINATOR and ROWTERMINATOR options instead.
Specify LINES TERMINATED BY '\r\n' in MySQL or set DELIMITER to E'\r\n' in PostgreSQL COPY.
The import will misalign columns unless the value is quoted and the command includes an ENCLOSED BY option that tells the engine how to treat quoted strings.