ClickHouse/docs/en/sql-reference/table-functions/sqlite.md

45 lines
934 B
Markdown
Raw Normal View History

2021-08-15 14:11:37 +00:00
---
toc_priority: 55
toc_title: sqlite
---
## sqlite {#sqlite}
2021-08-15 13:53:49 +00:00
Allows to perform queries on a data stored in an [SQLite](../../engines/database-engines/sqlite.md) database.
2021-08-15 13:53:49 +00:00
2021-08-15 14:11:37 +00:00
**Syntax**
2021-08-15 13:53:49 +00:00
``` sql
2021-08-15 16:34:10 +00:00
sqlite('db_path', 'table_name')
2021-08-15 13:53:49 +00:00
```
2021-08-15 16:34:10 +00:00
**Arguments**
2021-08-15 13:53:49 +00:00
- `db_path` — Path to a file with an SQLite database. [String](../../sql-reference/data-types/string.md).
- `table_name` — Name of a table in the SQLite database. [String](../../sql-reference/data-types/string.md).
2021-08-15 13:53:49 +00:00
2021-08-15 16:34:10 +00:00
**Returned value**
2021-08-15 13:53:49 +00:00
- A table object with the same columns as in the original `SQLite` table.
2021-08-15 13:53:49 +00:00
**Example**
Query:
``` sql
2021-08-18 13:32:34 +00:00
SELECT * FROM sqlite('sqlite.db', 'table1') ORDER BY col2;
2021-08-15 13:53:49 +00:00
```
Result:
``` text
2021-08-18 13:32:34 +00:00
┌─col1──┬─col2─┐
2021-08-18 13:40:09 +00:00
│ line1 │ 1 │
│ line2 │ 2 │
│ line3 │ 3 │
2021-08-18 13:32:34 +00:00
└───────┴──────┘
2021-08-15 13:53:49 +00:00
```
2021-08-15 16:34:10 +00:00
**See Also**
2021-08-15 13:53:49 +00:00
2021-08-18 13:40:09 +00:00
- [SQLite](../../engines/table-engines/integrations/sqlite.md) table engine