# SQL Block

<figure><img src="/files/PEQ9IOUjSaFO2HhIfKZp" alt=""><figcaption></figcaption></figure>

SQL Block is a block within the notebook that allows executing SQL.

Within the SQL Block, you can edit and run queries, display the results, view statistical information, and create charts.

## Key Features

* Professional SQL Editor with Powerful Support:
  * Includes features like function and reserved word suggestions, auto-completion, syntax highlighting, and formatting.
* Instant Result Preview:
  * Execute queries and preview results in real-time using Ctrl + Return.
* Table Search:
  * Use the `/` command within SQL blocks to search for tables within datasets and their connections. You can also search by metadata and field names in the catalog.
* Code Snippets:
  * Create code snippets for personal use or share them across the workspace. Customize settings like triggers and cursor positions after completion.
* Rich Shortcut Keys:
  * Utilize a various shortcut keys, which can also be customized for personal use.
* SQL Chain
  * Reference other SQL Blocks within an SQL Block. This helps manage complex SQL by breaking it down into more understandable and reusable components.
* Field Stats:
  * Easily retrieve statistical information for each field, such as data type, presence of null values, unique count, average value, quantile, frequency, and histogram.

## How to Use

* Creating an SQL Block:
  * While focused on an empty paragraph in a Doc Page, use the slash command (`/`) to select and create an SQL Block.
* Creating References:
  * Within the SQL Block, you can use the slash command to create references to other SQL Blocks and tables.
  * You can also create references to Parameters and Saved queries.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.codatum.com/data-exploration/notebook/sql-block.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
