SQL Explorer
Demo Environment
This environment resets nightly. Any data or connections you add are public.
SQL Explorer
New Query
Playground
Connections
Annotations
Logs
Favorites
Promplog list
no such table: Customers
Title
sqlite-sakila.db
MSSQL
db_1.db
Connection
hi how are you?
Description
SQL
WITH CustomerCategories AS ( SELECT c.CustomerID, p.CategoryID FROM Customers c JOIN Orders o ON c.CustomerID = o.CustomerID JOIN "Order Details" od ON o.OrderID = od.OrderID JOIN Products p ON od.ProductID = p.ProductID GROUP BY c.CustomerID, p.CategoryID ) SELECT p.CategoryID, COUNT(DISTINCT cc.CustomerID) AS CustomerCount FROM CustomerCategories cc JOIN Products p ON cc.CategoryID = p.CategoryID GROUP BY p.CategoryID ORDER BY CustomerCount DESC;
Assistant Example
Save & Run
Save Only
Download...
CSV
JSON
Show Schema
Hide Schema
SQL Assistant
Loading...
Assistant prompt
"Ask Assistant" to try and automatically fix the issue. The assistant is already aware of error messages & context.
Ask Assistant
Avg. execution: 39.201ms. Query created by admin on 2024-03-04.
History