未验证 提交 d20ac31f 编写于 作者: A alexey-milovidov 提交者: GitHub

Merge pull request #8434 from BayoNet/en-docs/CLICKHOUSEDOCS-508-faq-export-to-file

DOCS-508: FAQ: How export to file?
......@@ -21,4 +21,36 @@ If you use Oracle through the ODBC driver as a source of external dictionaries,
NLS_LANG=RUSSIAN_RUSSIA.UTF8
```
## How to export data from ClickHouse to the file?
### Using INTO OUTFILE Clause
Add [INTO OUTFILE](../query_language/select/#into-outfile-clause) clause to your query.
For example:
```sql
SELECT * FROM table INTO OUTFILE 'file'
```
By default, ClickHouse uses the [TabSeparated](../interfaces/formats.md#tabseparated) format for output data. To select the [data format](../interfaces/formats.md), use the [FORMAT clause](../query_language/select/#format-clause).
For example:
```sql
SELECT * FROM table INTO OUTFILE 'file' FORMAT CSV
```
### Using File-engine Table
See [File](../operations/table_engines/file.md).
### Using Command-line Redirection
```sql
$ clickhouse-client --query "SELECT * from table" > result.txt
```
See [clickhouse-client](../interfaces/cli.md).
[Original article](https://clickhouse.yandex/docs/en/faq/general/) <!--hide-->
......@@ -1120,7 +1120,7 @@ The structure of results (the number and type of columns) must match for the que
Queries that are parts of UNION ALL can't be enclosed in brackets. ORDER BY and LIMIT are applied to separate queries, not to the final result. If you need to apply a conversion to the final result, you can put all the queries with UNION ALL in a subquery in the FROM clause.
### INTO OUTFILE Clause
### INTO OUTFILE Clause {#into-outfile-clause}
Add the `INTO OUTFILE filename` clause (where filename is a string literal) to redirect query output to the specified file.
In contrast to MySQL, the file is created on the client side. The query will fail if a file with the same filename already exists.
......@@ -1128,7 +1128,7 @@ This functionality is available in the command-line client and clickhouse-local
The default output format is TabSeparated (the same as in the command-line client batch mode).
### FORMAT Clause
### FORMAT Clause {#format-clause}
Specify 'FORMAT format' to get data in any specified format.
You can use this for convenience, or for creating dumps.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册