# Inline edit
> Describe a change to the SQL under your cursor and get it back as a diff in the editor, with no chat panel and no copy-paste. Accept, reject, or refine it without leaving the tab.
Source: https://docs.querylab.io/prism-ai/inline-edit/
**Query 1**
```sql
«sel:SELECT * FROM `ace-analytics.warehouse.dim_vehicle`»
```
Add a WHERE clause to filter for diesel vehicles manufactured after 2015
and order by registration date
Enter to submit, Shift+Enter for new line
## Starting an edit
Select the SQL to change (or leave the cursor in a statement, or in an empty editor) and press `⌃ ⌘ I` (`Ctrl Win I` on Windows and Linux). **Edit with AI** in the editor's right-click menu does the same, and so does the **use AI** link in the empty-tab placeholder.
An input box opens above the selection. Type what you want, `Enter` to submit, `Shift Enter` for a new line, `Esc` to cancel, including mid-generation. Switching tabs cancels too.
The selected lines shimmer while the agent works.
## Reviewing the diff
The change is written into the editor as a diff: added lines highlighted green, removed lines shown in a red block where they were. A toolbar sits above the first change:
**Query 1 · reviewing**
```sql
SELECT * FROM `ace-analytics.warehouse.dim_vehicle`
«hl:WHERE fuel_type = 'DIESEL'
AND manufacture_year > 2015
ORDER BY first_registration_date»
```
Accept · Reject · Follow-up · Open in Prism AI
| Action | What happens |
| -------------------- | ---------------------------------------------------------------------------------- |
| **Accept** | Keeps the new SQL, clears the diff |
| **Reject** | Restores the original |
| **Follow-up** | Reopens the input for another instruction on the same edit; the diff stays visible |
| **Open in Prism AI** | Hands the edit and its context to the panel as a normal conversation |
In a query tab the undo history is untouched either way: `⌘ Z` after Accept still steps back through your own edits. In a notebook cell, Accept replaces the cell's content wholesale and resets its undo history.
## What the agent has
The whole tab, the selection, and the schema of the tables the query references. When the request needs more (an empty editor and a table name to discover, a multi-step rewrite) it delegates to the full panel and the conversation continues there with your prompt already sent.
The panel's [mode](https://docs.querylab.io/prism-ai/modes/) selector doesn't apply here: the diff is the approval.
## What to ask for
| You type | Result |
| ----------------------------------- | -------------------------------------------------------------- |
| add a WHERE clause for active users | `WHERE status = 'active'` on the right table |
| convert to a CTE | The subquery becomes a `WITH` block |
| alias every column | `AS` on each SELECT item |
| use the partition column | Adds a filter on the table's partition column, from the schema |
## Notebook cells and quick fixes
Every notebook cell is its own editor: select inside a cell and use the same shortcut. The lightbulb's **Fix with Prism AI** on a [diagnostic](https://docs.querylab.io/writing-sql/code-quality/) runs the same flow with the error message and the rule's own suggested fixes as the prompt, and shimmers only the lines the diagnostic covers.