> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Selecionando dados do ClickHouse

> Saiba mais sobre como selecionar dados do ClickHouse

export const e_1 = undefined

export const e_0 = undefined

<a href="/docs/get-started/quickstarts/home" onClick={(e_0) => { e_0.preventDefault(); window.location.href = (window.location.pathname.startsWith('/docs') ? '/docs' : '') + '/get-started/quickstarts/home'; }} className="inline-flex items-center gap-1.5 text-sm text-gray-500 dark:text-zinc-500 hover:text-gray-900 dark:hover:text-[#fdff75] transition-colors font-normal no-underline"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="shrink-0"><path d="M19 12H5" /><path d="M12 19l-7-7 7-7" /></svg>All quickstarts</a>

<div className="mt-2 flex flex-wrap gap-2">
  <Badge size="lg" color="blue">Analytics em tempo real</Badge>
  <Badge size="lg" color="blue">Armazenamento de dados</Badge>
  <Badge size="lg" color="blue">Observabilidade</Badge>
  <Badge size="lg" color="blue">AI/ML</Badge>
  <Badge size="lg" color="orange">OSS</Badge>
</div>

ClickHouse é um banco de dados SQL, e você consulta seus dados escrevendo o mesmo tipo de consultas `SELECT` que já conhece. Por exemplo:

```sql theme={null}
SELECT *
FROM helloworld.my_first_table
ORDER BY timestamp
```

<Note>
  Consulte a [Referência SQL](/docs/pt-BR/reference/statements/select/index) para mais detalhes sobre a sintaxe, as cláusulas e as opções disponíveis.
</Note>

Observe que a resposta vem em um formato de tabela bem organizado:

```response theme={null}
┌─user_id─┬─message────────────────────────────────────────────┬───────────timestamp─┬──metric─┐
│     102 │ Insert a lot of rows per batch                     │ 2022-03-21 00:00:00 │ 1.41421 │
│     102 │ Sort your data based on your commonly-used queries │ 2022-03-22 00:00:00 │   2.718 │
│     101 │ Hello, ClickHouse!                                 │ 2022-03-22 14:04:09 │      -1 │
│     101 │ Granules are the smallest chunks of data read      │ 2022-03-22 14:04:14 │ 3.14159 │
└─────────┴────────────────────────────────────────────────────┴─────────────────────┴─────────┘

4 rows in set. Elapsed: 0.008 sec.
```

Adicione uma cláusula `FORMAT` para especificar um dos [muitos formatos de saída compatíveis com o ClickHouse](/docs/pt-BR/reference/formats/index#formats-overview):

```sql theme={null}
SELECT *
FROM helloworld.my_first_table
ORDER BY timestamp
FORMAT TabSeparated
```

Na consulta acima, a saída é exibida separada por tabulações:

```response theme={null}
Query id: 3604df1c-acfd-4117-9c56-f86c69721121

102 Insert a lot of rows per batch      2022-03-21 00:00:00     1.41421
102 Sort your data based on your commonly-used queries  2022-03-22 00:00:00     2.718
101 Hello, ClickHouse!  2022-03-22 14:04:09     -1
101 Granules are the smallest chunks of data read       2022-03-22 14:04:14     3.14159

4 rows in set. Elapsed: 0.005 sec.
```

<Note>
  O ClickHouse oferece suporte a mais de 70 formatos de entrada e saída, então, entre os milhares de funções e todos os formatos de dados, você pode usar o ClickHouse para realizar transformações de dados rápidas e impressionantes, no estilo ETL. Na verdade, você nem
  precisa ter um servidor ClickHouse em execução para transformar dados — basta usar a ferramenta `clickhouse-local`. Consulte a [página da documentação do `clickhouse-local`](/docs/pt-BR/concepts/features/tools-and-utilities/clickhouse-local) para mais detalhes.
</Note>

<div className="mt-8">
  <a href="/docs/get-started/quickstarts/home" onClick={(e_1) => { e_1.preventDefault(); window.location.href = (window.location.pathname.startsWith('/docs') ? '/docs' : '') + '/get-started/quickstarts/home'; }} className="inline-flex items-center gap-1.5 text-sm text-gray-500 dark:text-zinc-500 hover:text-gray-900 dark:hover:text-[#fdff75] transition-colors font-normal no-underline"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="shrink-0"><path d="M19 12H5" /><path d="M12 19l-7-7 7-7" /></svg>All quickstarts</a>
</div>
