# Database page

> One database on AirHost: its tables, a place to type SQL, and the rows a query returns.

Source: https://air.build/docs/screens/platform/database-page/

A database's page lets you look inside one of your app's databases: tap a table to see its first rows, or type your own SQL and run it. The page is titled with the database's name.

> [!WARNING]
> **Run** sends your SQL straight to the database. A query that deletes or changes data does so right away, with no undo.

## Open it

In [Databases](https://air.build/docs/screens/platform/databases/), tap the database's row, or touch and hold it (on the Mac, right-click it) and choose **Open Database**.

**iPhone**

It opens as the next page; **Back** returns to the tab.

**Mac**

It opens as a sheet beside the chat. **Cancel** closes it.

## What's on it

| Part | What it shows or does | Default |
| --- | --- | --- |
| **Tables** | One button per table. Tap one to see its first 50 rows. | — |
| **SQL** | The query to run. | A query that lists the database's tables |
| **Run** | Runs the query in **SQL**. Dimmed while it's empty; spins while the query runs. | — |
| **Results** | The rows the last query returned, one column per field (`id` first), scrolling sideways when wide. Empty values read `NULL`. The header gives the row count ("12 rows") and how long the query took, in milliseconds. Only after a query. | — |

You can select and copy the text of any cell.

## Messages

| Message | When | What to do |
| --- | --- | --- |
| "Loading…" | The tables are being read. | Wait. |
| "No tables yet." | The database is empty. | Ask your Agents to set it up, or create tables with SQL. |
| The reason, with **Try Again** | The tables couldn't be read. | Tap **Try Again**. |
| The database's error, with a warning triangle, under the query | The query failed, for example because of a typo. | Fix the query and tap **Run**. |
| "The query completed without returning rows." | The query ran and returned nothing (for example an `UPDATE`). | — |
