Query editor
The query editor lets you run SQL against the connected PostgreSQL database.
Common query examples
SELECT * FROM bookings LIMIT 10;
SELECT status, COUNT(*)
FROM bookings
GROUP BY status
ORDER BY status;
SELECT rooms.name, rooms.price_per_night
FROM rooms
ORDER BY rooms.price_per_night DESC;
Run a query
- Open the database tool from the workspace.
- Choose Query.
- Write a focused SQL statement.
- Execute it.
- Review the result table.
- Save the query externally if it is useful for later testing.
Useful checks
| Goal | Query pattern |
|---|---|
| Confirm records exist | select count(*) from table_name; |
| Inspect latest records | order by created_at desc limit 20 |
| Check status workflow | select status, count(*) from table_name group by status; |
| Verify relationships | Join child records to their parent record by ID. |
| Find empty fields | Filter where important columns are null or empty. |
Query safely
- Start with
SELECTqueries. - Use
LIMITwhen inspecting large tables. - Avoid destructive statements unless you are in a test database.
- Keep a copy of important data before bulk updates.
Keyboard shortcut
Use Cmd + Enter on macOS or Ctrl + Enter on Windows/Linux when the query editor supports quick execution.