# SQL editor

Open **SQL Editor** in the sidebar to run SQL against the database you have selected.

## Write and run

Type your SQL in the editor. Studio suggests table and column names as you type.

To run it, choose **Run** or press **⌘↵**. Studio runs everything in the editor.

## Results

The results appear below the editor. Drag the line between them to give either one more room.

Statements that don't return rows, like `UPDATE` or `CREATE TABLE`, show **No columns returned.** If a statement fails, the error appears instead of the results.

## Tabs

Each query opens in its own tab. Choose **New query** or press **⌘N** to start one, and close a tab with its **×**.

## Saved queries

Studio saves a query the first time you run it, named after its SQL. Running it again saves your changes.

Saved queries appear under **Queries** next to the editor. Click one to open it, type in **Search queries…** to find one, or delete one you no longer need. Each database keeps its own queries.

> **Schema changes**
>
> Changing the schema here, for example with `CREATE TABLE`, changes the
> database without a migration file. In a project, Studio flags it as [schema
> drift](https://fakebase.studio/docs/schema-drift.md) so you can save it as a migration.

---

## Next steps

- [Data](https://fakebase.studio/docs/studio-data.md): Browse, insert, edit, and delete table rows in Fakebase Studio.
- [Schema drift](https://fakebase.studio/docs/schema-drift.md): Capture schema changes that already landed in the database as a migration file.
