Guide

Run Query in SQL Editor

Overview

Supabase's SQL Editor is a browser-based interface that allows you to write and execute SQL queries directly against your Postgres database without leaving the Supabase Studio dashboard. This is essential for testing queries, debugging data issues, and exploring your database structure during development. The SQL Editor supports full SQL syntax and provides real-time query execution, making it ideal for ad hoc data retrieval and validation tasks. This workflow demonstrates how to run a query that fetches up to 100 rows from a test table, a common operation for data inspection and verification.

Before you begin

  • A Supabase account (free or paid) with an active project
  • Access to a Supabase project dashboard at supabase.com
  • An existing table in your Postgres database (in this case, a table named 'test-table')
  • At least read permissions on the target table

Step by step

1
ClickSQL Editor

Navigate to the SQL Editor by clicking the 'SQL Editor' link in the left sidebar of your Supabase project dashboard. This opens the query interface where you can write and execute SQL commands.

Tip. The SQL Editor is a core feature available in all Supabase projects. You can access it anytime from the main project navigation without leaving the dashboard.
Step 1
2
ClickSelect * FROM test-table limit 100

Click on the query template or example that displays 'Select * FROM test-table limit 100' to either select it as a starting point or to populate the editor with this query structure. This pre-written template saves time and ensures correct syntax.

Tip. Supabase often provides query templates for common operations. Using a template is faster than typing from scratch and helps avoid syntax errors.
Step 2
3
TypeEditor content

Type or paste your SQL query into the editor content area. If you're using the template from the previous step, you can modify it here to adjust the table name, add WHERE clauses, or change the LIMIT value as needed.

Tip. Use keyboard shortcuts like Ctrl+A (or Cmd+A on Mac) to select all text, and Ctrl+/ (or Cmd+/) to toggle comments. The editor supports syntax highlighting and basic autocomplete for table and column names.
4
ClickRun ⌘ ↵

Execute your query by clicking the 'Run' button (displayed with a keyboard shortcut icon ⌘ ↵). The SQL Editor will send your query to the Postgres database and display results in the panel below.

Tip. You can also run your query using the keyboard shortcut: Cmd+Enter on Mac or Ctrl+Enter on Windows/Linux. This is faster than clicking the button repeatedly.
Warning. Ensure your query is safe before running—for example, avoid running DELETE or UPDATE queries on production data without a WHERE clause to limit the scope.
Step 4
5
TypeEditor content

Review or modify your query further by typing additional SQL commands or adjustments into the editor content area. This allows you to refine your query, add filters, or test variations without clearing previous results.

Tip. You can run multiple queries sequentially in the same editor session. Each execution will append or replace results depending on how you structure your queries. Separate multiple queries with semicolons if executing them as a batch.

Confirm it worked

  1. 1The SQL Editor tab is visible and active in the Supabase Studio interface
  2. 2Your query appears in the editor window with proper syntax highlighting
  3. 3A results panel appears below the query editor showing returned rows (up to 100 rows displayed)
  4. 4The query execution status shows 'Success' or displays the number of rows returned

Common issues

Keep reading