# Write and run queries

[Wiki](../README.md) / [Station](README.md)

The **Explore** view is where you write Cypher and read the results. It talks to the server
you picked in the Servers panel, and to the database named above the editor.

## The editor

- **Run:** **Ctrl+Enter** (**⌘↵** on macOS) or **Run**. Several statements separated by `;`
  run in order on one connection, each as its own transaction. The first error stops the
  run and shows where it happened; the statements before it stay committed. The result
  views show the last statement's result.
- **Stop:** **Cancel** or **Esc** while a query runs.
- **Plans:** **EXPLAIN** shows how one statement would run without running it. **PROFILE**
  runs it and shows rows, database hits and time for each step, in the **Plan** view.
- **Completion:** keywords, labels, relationship types and property keys as you type after
  `:`, `.` and `$`, or with **Ctrl+Space**.
- **Find and replace:** **Ctrl+F** (**⌘F**).
- **Parameters:** **Params** opens a panel for the `$name` values your query uses, written
  as a map: `{prefix: 'Al', limit: 25}`.
- **Size:** drag the handle under the editor to make it taller or shorter; double-click it
  to reset.

The line under the editor says which server and database you are connected to, or why a
query cannot run yet.

## Query tabs

Each tab keeps its own query, database, parameters and results. **Ctrl+T** (**⌘T**) opens a
tab, **Ctrl+W** (**⌘W**) closes it, and **Ctrl+Tab** / **Ctrl+Shift+Tab** move between them.
Right-click a database in the Servers panel, or use **Browse data** and **Visualise schema**
in the right-hand panel, to open a query in a new tab.

## Results

Results show up to 1,000 rows. Pick a view above them:

- **Graph:** nodes and relationships as a force layout, in **2D** or **3D**. Double-click a
  node to load its neighbours, drag a node to pin it, and scroll to zoom. In 3D, Shift+drag
  orbits the camera and **Depth** sets the perspective. **Fit** brings everything into view,
  and **Save image** writes a PNG or SVG. Select a node or relationship to
  see and edit its properties in the right-hand panel. **+ Node** creates a node, and
  Alt+drag from one node to another creates a relationship between them.
- **Table:** one row per result. Right-click a cell to copy it.
- **JSON:** the result as JSON, ready to copy.
- **Spatial:** points and shapes from the result on a map.
- **Schedule:** a plan from the [Native Scheduler](../gds/scheduling.md) as a Gantt chart, with
  one lane per stage, carer or room, or per person with **Lanes**. Click a bar to see its times
  and every timeline it uses. Any result with a start and an end per row draws the same way.
  Drag or scroll sideways to pan, and Ctrl+scroll to zoom time.
- **Plan:** the operator tree from **EXPLAIN** or **PROFILE**.

**Export** saves the result as CSV or JSON.

A result from `gdb.schedule.solve.stats` opens on **Schedule** by itself. To write one,
**▤ Schedule** above the editor opens the schedule builder: choose the tasks and resources, the
people involved, when resources are available, who can take what, rules such as most tasks
each, and what matters most. The Cypher updates as you edit. **Insert into editor** puts it in
the tab, and **Run** runs it too. It writes the same Cypher as the builder in
[Explorer](../integrations/explorer.md#schedule-builder), and the built-in database runs it,
so scheduling works with nothing else installed.

## The information panel

The right-hand panel (**Ctrl+I**, **⌘I**) shows the connected database's labels,
relationship types, property keys, indexes and constraints. Click a label or type to query
it in a new tab. **+** beside Indexes or Constraints creates one, and every change shows the
Cypher it runs. The panel appears once you are connected to a server.

## Related articles

[Snippets and history](snippets.md) · [Cypher](../cypher/README.md) · [Indexes and constraints](../indexes/README.md)
