layers

ExplainQL

Understand Your SQL Instantly

Paste your stored procedures or views, or upload a file to get a detailed analysis — broken down section by section, with visual diagrams and a built-in AI chat.

Or Upload a File

How it works

Three steps from raw SQL to full understanding.

1

Paste or upload your SQL

Drop in a stored procedure, a view, or any ad-hoc query. Files up to 5 MB are supported.

2

AI breaks it down

Our analysis engine maps every section, parameter, join, and dependency into a structured result.

3

Explore the output

Click through the code breakdown, spin up the diagram views, or ask the AI follow-up questions.

Everything you need to understand complex SQL

From code breakdown to visual maps — all in one place.

Instant SQL Breakdown

Paste any stored procedure, view, or query and get a structured breakdown of every section — what it does, which tables it touches, and why.

SQL overview panel showing code breakdown

Visual Table Relationships

See how your tables connect. The SQL Map automatically generates a Mermaid diagram of all joins, foreign keys, and data flows in your query.

SQL map showing table relationship diagram

Dependency Graph

Understand upstream and downstream dependencies at a glance. Know exactly what each part of your query relies on before you change it.

SQL dependencies view

Saved Analysis History

Every analysis you run can be saved and organized into folders. Come back to any query at any time — no re-running needed.

History panel showing saved analyses

Chat with your SQL code

Ask questions about your query in plain English. The built-in AI assistant understands your full SQL context — stored procedures, joins, parameters, and logic — so you can get answers without leaving the analysis.

  • check_circleAsk what any section does in plain English
  • check_circleGet performance suggestions and index recommendations
  • check_circleReceive rewritten SQL snippets you can copy directly
chatAI Assistant

What does this stored procedure do?

This stored procedure usp_GetOrderSummary retrieves a summary of customer orders within a given date range. Here's the breakdown:

1.Parameters — It accepts @StartDate and @EndDate to filter the Orders table.
2.Joins — It inner-joins OrdersCustomers and OrdersOrderItemsProducts to pull customer names and line-item details.
3.Aggregation — Groups results by customer and calculates TotalAmount and ItemCount per customer.
4.Output — Returns customer name, order count, total spend, and item count sorted by total spend descending.

Are there any performance concerns with the joins?

Yes — two things to watch:

-The join from OrderItemsProducts scans the full Products table since there's no filter on it. Adding a covering index on Products(ProductID) including ProductName would help.
-The GROUP BY on CustomerName (a string) is slower than grouping by CustomerID and joining the name after aggregation.

-- Faster: group by ID, join name after

SELECT c.CustomerName, agg.TotalAmount

FROM (

SELECT CustomerID, SUM(Amount) AS TotalAmount

FROM Orders GROUP BY CustomerID

) agg

JOIN Customers c ON c.CustomerID = agg.CustomerID

sqlCopy
-- Faster: group by ID, join name after
SELECT c.CustomerName, agg.TotalAmount
FROM (
  SELECT CustomerID, SUM(Amount) AS TotalAmount
  FROM Orders GROUP BY CustomerID
) agg
JOIN Customers c ON c.CustomerID = agg.CustomerID
Ask a question about this SQL...
Send

Ready to demystify your SQL?

Paste your first query above — no account required to try it.