Try a query

Sample queries

Start with a question about the data, then adapt the SQL for your own database engine.

Exact decimals · hosted OVDB query

Sum without floating-point loss

Columns marked exact decimal are text-backed so their digits survive JSON and browser snapshots. Add the opt-in money settings to a hosted DTQL aggregate to calculate exact sums and averages with half-even rounding. Aggregate results stay decimal strings. The table explorer separately sorts provider-declared decimal columns exactly without converting them to JavaScript numbers.

from: {database: adventureworks, name: 'HumanResources.EmployeePayHistory', alias: source}
money: {minorUnitScale: 4, divisionScale: 4, rounding: halfEven}
columns:
  - {aggregate: {function: sum, args: [{field: Rate, source: source}]}, as: Total}
  - {aggregate: {function: avg, args: [{field: Rate, source: source}]}, as: Average}
Open the read-only OVDB API →

AdventureWorks OLTP

Orders by customer

List sales orders with the account they belong to and their totals.

SELECT h."SalesOrderNumber", c."CustomerID", h."OrderDate", h."TotalDue" FROM "Sales.SalesOrderHeader" AS h JOIN "Sales.Customer" AS c USING ("CustomerID") ORDER BY h."OrderDate" DESC LIMIT 20;
Get the database →

AdventureWorks OLTP

Products on sales orders

Show products, ordered quantities, unit prices, and stored line totals.

SELECT p."Name", d."OrderQty", d."UnitPrice", d."LineTotal" FROM "Sales.SalesOrderDetail" AS d JOIN "Production.Product" AS p USING ("ProductID") ORDER BY d."SalesOrderID", d."SalesOrderDetailID" LIMIT 20;
Get the database →

AdventureWorks OLTP

Purchase orders by vendor

Summarize purchase orders with vendor names and recorded amounts.

SELECT v."Name", h."PurchaseOrderID", h."OrderDate", h."TotalDue" FROM "Purchasing.PurchaseOrderHeader" AS h JOIN "Purchasing.Vendor" AS v ON v."BusinessEntityID" = h."VendorID" ORDER BY h."OrderDate" DESC LIMIT 20;
Get the database →

AdventureWorks OLTP

Inventory by location

List current product inventory by production location.

SELECT p."Name", l."Name" AS "Location", i."Quantity" FROM "Production.ProductInventory" AS i JOIN "Production.Product" AS p USING ("ProductID") JOIN "Production.Location" AS l USING ("LocationID") ORDER BY p."Name", l."Name" LIMIT 20;
Get the database →