> For the complete documentation index, see [llms.txt](https://docs.airbook.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.airbook.io/explore/using-the-query-builder.md).

# Using the Query Builder

Airbook's **Query Builder** allows you to retrieve and manipulate data **without writing SQL**. Simply select your desired options, and the Query Builder will generate an **SQL-equivalent output** for you.

To get started type / and pick Query Builder from the dropdown.

***

{% embed url="<https://youtu.be/wxcRUM5toG4>" %}

### Configuring Your Query

#### 1. Opening the Query Builder

* Click the **Edit** button to open the Query Builder menu.
* The menu consists of:
  * **Left Panel:** Configuration options for generating your query.
  * **Right Panel:** A preview of the table output.

***

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

#### 2. Selecting Your Data

1. Click **+ Select Table** in the Left Panel.
2. Choose:
   * **Datasource**
   * **Dataset**
   * **Table**
3. Select columns to include:
   * Choose **all columns** or **specific columns**.
   * Create **aggregate columns** if needed.
4. Click **Add Columns** to apply changes.

***

#### 3. Adding Joins

* You can join another table **only if it belongs to the same datasource**.
* Select columns for the second table after identifying a **common column** (join key).

**Types of Joins:**

* **Left Join**: Returns all records from the left table and matching records from the right table.&#x20;
* **Right Join**: Returns all records from the right table and matching records from the left table.&#x20;
* **Inner Join**: Returns only records with matching values in both tables.
* **Outer Join**: Returns all records from both tables, filling missing values with NULL.

***

#### 4. Adding a Calculated Column

Create new fields by applying calculations to existing columns.

1. **Name Your Column** (e.g., `profit`).
2. **Select Aggregation Method** (if applicable).
3. **Write Your Formula** (e.g., calculating profit):

   `Table1.selling_price - Table1.cost`
4. Click **Add** to save.

Your new column will now appear in the query results.

***

#### 5. Applying Conditions (Filters)

* Select a **column** to filter.
* Choose an **operator** (e.g., `=`, `>`, `<`).
* Enter a **value**.
* Add **multiple conditions** if needed.
* Click **Apply** to filter the results.

***

#### 6. Sorting Results

* Choose a **column** to sort by.
* Select the **sort order**: Ascending (A → Z) or Descending (Z → A).

***

#### 7. Limiting Rows (Show Only)

* Specify the **maximum number of rows** to display.

***

#### 8. Executing Your Query

* Click **Preview** to check the results before running the query.
* Click **Run** to execute and **save your changes**.

By following these steps, you can **build and modify queries efficiently** without writing SQL!
