Table Functions

|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [jdbc](/docs/sql-reference/table-functions/jdbc) Returns a table that is connected via JDBC driver.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [merge](/docs/sql-reference/table-functions/merge) Creates a temporary Merge table. The structure will be derived from underlying tables by using a union of their columns and by deriving common types.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [mongodb](/docs/sql-reference/table-functions/mongodb) Allows `SELECT` queries to be performed on data that is stored on a remote MongoDB server.| [mysql](/docs/sql-reference/table-functions/mysql) Allows `SELECT` and `INSERT` queries to be performed on data that are stored on a remote MySQL server.| [null](/docs/sql-reference/table-functions/null) Creates a temporary table of the specified structure with the Null table engine. The function is used for the convenience of test writing and demonstrations.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [numbers](/docs/sql-reference/table-functions/numbers) Returns a table with a single `number` column that contains a sequence of integers.| [primes](/docs/sql-reference/table-functions/primes) Returns a table with a single `prime` column that contains prime numbers.| [prometheusQuery](/docs/sql-reference/table-functions/prometheusQuery) Evaluates a prometheus query using data from a TimeSeries table.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [prometheusQueryRange](/docs/sql-reference/table-functions/prometheusQueryRange) Evaluates a prometheus query using data from a TimeSeries table.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [timeSeriesData](/docs/sql-reference/table-functions/timeSeriesData) timeSeriesData returns the data table used by table `db_name.time_series_table` whose table engine is TimeSeries.| [timeSeriesMetrics](/docs/sql-reference/table-functions/timeSeriesMetrics) timeSeriesMetrics returns the metrics table used by table `db_name.time_series_table` whose table engine is the TimeSeries engine.| [timeSeriesSelector](/docs/sql-reference/table-functions/timeSeriesSelector) Reads time series from a TimeSeries table filtered by a selector and with timestamps in a specified interval.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [timeSeriesTags](/docs/sql-reference/table-functions/timeSeriesTags) timeSeriesTags table function returns the tags table use by table `db_name.time_series_table` whose table engine is the TimeSeries engine.| [zeros](/docs/sql-reference/table-functions/zeros) Used for test purposes as the fastest method to generate many rows. Similar to the `system.zeros` and `system.zeros_mt` system tables.| [generate\_series (generateSeries)](/docs/sql-reference/table-functions/generate_series) Returns a table with the single `generate_series` column (UInt64) that contains integers from start to stop inclusively.| [odbc](/docs/sql-reference/table-functions/odbc) Returns the table that is connected via ODBC.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [postgresql](/docs/sql-reference/table-functions/postgresql) Allows `SELECT` and `INSERT` queries to be performed on data that is stored on a remote PostgreSQL server.| [redis](/docs/sql-reference/table-functions/redis) This table function allows integrating ClickHouse with Redis.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [remote, remoteSecure](/docs/sql-reference/table-functions/remote) Table function `remote` allows to access remote servers on-the-fly, i.e. without creating a distributed table. Table function `remoteSecure` is same as `remote` but over a secure connection.| [s3 Table Function](/docs/sql-reference/table-functions/s3) Provides a table-like interface to select/insert files in Amazon S3 and Google Cloud Storage. This table function is similar to the hdfs function, but provides S3-specific features.|  |  |  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [s3Cluster](/docs/sql-reference/table-functions/s3Cluster) An extension to the s3 table function, which allows processing files from Amazon S3 and Google Cloud Storage in parallel with many nodes in a specified cluster.|  |  |  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [sqlite](/docs/sql-reference/table-functions/sqlite) Allows to perform queries on data stored in a SQLite database.|  |  |  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [arrowFlight](/docs/sql-reference/table-functions/arrowflight) Allows to perform queries on data exposed via an Apache Arrow Flight server.|  |  |  |  |  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | [url](/docs/sql-reference/table-functions/url) Creates a table from the `URL` with given `format` and `structure`| [urlCluster](/docs/sql-reference/table-functions/urlCluster) Allows processing files from URL in parallel from many nodes in a specified cluster.|  |  |  |  |  |  | | --- | --- | --- | --- | --- | --- | | [values](/docs/sql-reference/table-functions/values) creates a temporary storage which fills columns with values.|  |  |  |  | | --- | --- | --- | --- | | [view](/docs/sql-reference/table-functions/view) Turns a subquery