# Example: Exporting to `CSV` File
+ You can export data to `CSV` files by adding the **`--filetype csv`** argument
+ When you export data to `CSV` files, you can use **`--sql {sql_statement}`** to filter the records with the `SQL` statements
+ You can use options like **`--csv-separator`** and **`--csv-delimiter`** to configure the CSV file format
+ You can export CSV files of the tables without generating header by using **`--no-header`**
+ For example, you can export all records that match `id < 100` in `universe.planets` using the following command:

```
$ tiup dumpling \
  -u root \
  -P 4000 \
  -h 127.0.0.1 \
  -o /tmp/test \
  ~!@--filetype csv@!~ \
  --sql 'select * from `universe`.`planets` where id < 100' \
  -F 100MiB \
  --output-filename-template 'universe.planets.{{.Index}}'
```

-------------------------------------------------------------
The `--sql` option can be used only for exporting to `CSV` files. The command above executes the `SELECT * FROM {table_name} WHERE id <100` statement on all tables to be exported. If a table does not have the specified field, the export fails.

When you use the `--sql` option, `Dumpling` cannot obtain the exported table and schema information. You can specify the file name format of the `CSV` files using the `--output-filename-template` option, which facilitates the subsequent use of `TiDB Lightning` to import the data file. For example, `--output-filename-template='universe.planets.{{.Index}}'` specifies that the exported `CSV` files are named as `universe.planets.000000000` or `universe.planets.000000001`.

You can use options like `--csv-separator` and `--csv-delimiter` to configure the `CSV` file format. `--csv-delimiter` enbraces strings, while `--csv-separators` separates columns. For example, if the `--csv-delimiter` is `*` and the `--csv-separators` is `/`, then the row `1 tom 13811766431 beijing 32` will be encoded as `1/*tom*/*13811766431*/*beijing*/32`.