2020-04-03 13:23:32 +00:00
---
toc_priority: 38
toc_title: merge
---
2020-03-20 10:10:48 +00:00
# merge {#merge}
2017-12-28 15:13:23 +00:00
2021-11-01 10:39:25 +00:00
Creates a temporary [Merge ](../../engines/table-engines/special/merge.md ) table. The table structure is taken from the first table encountered that matches the regular expression.
2017-12-28 15:13:23 +00:00
2021-11-01 10:39:25 +00:00
**Syntax**
```sql
merge('db_name', 'tables_regexp')
```
**Arguments**
2021-11-02 14:29:20 +00:00
- `db_name` — Possible values:
- database name,
- constant expression that returns a string with a database name, for example, `currentDatabase()` ,
- `REGEXP(expression)` , where `expression` is a regular expression to match the DB names.
2021-11-01 10:39:25 +00:00
- `tables_regexp` — A regular expression to match the table names in the specified DB or DBs.
**See Also**
- [Merge ](../../engines/table-engines/special/merge.md ) table engine
2017-12-28 15:13:23 +00:00