SQL Explorer
Demo Environment
This environment resets nightly. Any data or connections you add are public.
SQL Explorer
New Query
Playground
Connections
Logs
Favorites
Employee sales performance
no such table: Orders
Title
default
tq
base
history_1390634-1970-01-01-MAX_1.db
RMS
179146-Activity_2024-07-12_07-47_101208779_1.db
job_summary_1.db
vehicles_1.db
job_skills_1.db
IMDbMovies-Clean_1.db
sqlite-sakila.db
northwind.db
transactions_1.db
organizations-100000_1.db
maestro-v3.0.0_1.db
job_postings_1.db
Connection
Who are our best employees, based on sales?
Description
SQL
WITH EmployeeSales AS (SELECT o.EmployeeID, SUM(od.UnitPrice * od.Quantity) AS TotalSales FROM Orders o JOIN "Order Details" od ON o.OrderID = od.OrderID GROUP BY o.EmployeeID) SELECT e.EmployeeID, e.LastName, e.FirstName, e.Title, es.TotalSales FROM EmployeeSales es JOIN Employees e ON es.EmployeeID = e.EmployeeID ORDER BY es.TotalSales ASC;
Save & Run
Save Only
Download...
CSV
JSON
Show Schema
Hide Schema
Format
SQL Assistant
Assistant prompt
"Ask Assistant" to try and automatically fix the issue. The assistant is already aware of error messages & context.
Select All
(?)
Search tables
Ask Assistant
Loading...
Avg. execution: 287.043ms. Query created by admin on 2024-05-17.
History