SELECT ... FROM loop(database, table);
SELECT ... FROM loop(database.table);
SELECT ... FROM loop(table);
SELECT ... FROM loop(other_table_function(...));
| Argumento | Descrição |
|---|
database | nome do banco de dados. |
table | nome da tabela. |
other_table_function(...) | outra função de tabela. Exemplo: SELECT * FROM loop(numbers(10)); other_table_function(...) aqui é numbers(10). |
Loop infinito para retornar os resultados da consulta.
Seleção de dados do ClickHouse:
SELECT * FROM loop(test_database, test_table);
SELECT * FROM loop(test_database.test_table);
SELECT * FROM loop(test_table);
Ou usando outras funções de tabela:
SELECT * FROM loop(numbers(3)) LIMIT 7;
┌─number─┐
1. │ 0 │
2. │ 1 │
3. │ 2 │
└────────┘
┌─number─┐
4. │ 0 │
5. │ 1 │
6. │ 2 │
└────────┘
┌─number─┐
7. │ 0 │
└────────┘
SELECT * FROM loop(mysql('localhost:3306', 'test', 'test', 'user', 'password'));
...
Última modificação em 10 de junho de 2026