Northwind › SQL Console
SQL Console
Type a SELECT and run it against the Northwind database. This is SQLite 3.45, so SQLite's own functions, window functions, recursive CTEs, EXPLAIN QUERY PLAN and PRAGMA table_info(…) all work. Table names that contain a space need double quotes: "Order Details".
Result
| OrderID | CustomerID | EmployeeID | OrderDate | RequiredDate | ShippedDate | ShipVia | Freight | ShipName | ShipAddress | ShipCity | ShipRegion | ShipPostalCode | ShipCountry |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10248 | VINET | 5 | 1996-07-04 | 1996-08-01 | 1996-07-16 | 3 | 32.38 | Vins et alcools Chevalier | 59 rue de l'Abbaye | Reims | NULL | 51100 | France |
| 10249 | TOMSP | 6 | 1996-07-05 | 1996-08-16 | 1996-07-10 | 1 | 11.61 | Toms Spezialitäten | Luisenstr. 48 | Münster | NULL | 44087 | Germany |
| 10250 | HANAR | 4 | 1996-07-08 | 1996-08-05 | 1996-07-12 | 2 | 65.83 | Hanari Carnes | Rua do Paço, 67 | Rio de Janeiro | RJ | 05454-876 | Brazil |
| 10251 | VICTE | 3 | 1996-07-08 | 1996-08-05 | 1996-07-15 | 1 | 41.34 | Victuailles en stock | 2, rue du Commerce | Lyon | NULL | 69004 | France |
| 10252 | SUPRD | 4 | 1996-07-09 | 1996-08-06 | 1996-07-11 | 2 | 51.3 | Suprêmes délices | Boulevard Tirou, 255 | Charleroi | NULL | B-6000 | Belgium |
| 10253 | HANAR | 3 | 1996-07-10 | 1996-07-24 | 1996-07-16 | 2 | 58.17 | Hanari Carnes | Rua do Paço, 67 | Rio de Janeiro | RJ | 05454-876 | Brazil |
| 10254 | CHOPS | 5 | 1996-07-11 | 1996-08-08 | 1996-07-23 | 2 | 22.98 | Chop-suey Chinese | Hauptstr. 31 | Bern | NULL | 3012 | Switzerland |
| 10255 | RICSU | 9 | 1996-07-12 | 1996-08-09 | 1996-07-15 | 3 | 148.33 | Richter Supermarkt | Starenweg 5 | Genève | NULL | 1204 | Switzerland |
| 10256 | WELLI | 3 | 1996-07-15 | 1996-08-12 | 1996-07-17 | 2 | 13.97 | Wellington Importadora | Rua do Mercado, 12 | Resende | SP | 08737-363 | Brazil |
| 10257 | HILAA | 4 | 1996-07-16 | 1996-08-13 | 1996-07-22 | 3 | 81.91 | HILARION-Abastos | Carrera 22 con Ave. Carlos Soublette #8-35 | San Cristóbal | Táchira | 5022 | Venezuela |
| 10258 | ERNSH | 1 | 1996-07-17 | 1996-08-14 | 1996-07-23 | 1 | 140.51 | Ernst Handel | Kirchgasse 6 | Graz | NULL | 8010 | Austria |
| 10259 | CENTC | 4 | 1996-07-18 | 1996-08-15 | 1996-07-25 | 3 | 3.25 | Centro comercial Moctezuma | Sierras de Granada 9993 | México D.F. | NULL | 05022 | Mexico |
| 10260 | OTTIK | 4 | 1996-07-19 | 1996-08-16 | 1996-07-29 | 1 | 55.09 | Ottilies Käseladen | Mehrheimerstr. 369 | Köln | NULL | 50739 | Germany |
| 10261 | QUEDE | 4 | 1996-07-19 | 1996-08-16 | 1996-07-30 | 2 | 3.05 | Que Delícia | Rua da Panificadora, 12 | Rio de Janeiro | RJ | 02389-673 | Brazil |
| 10262 | RATTC | 8 | 1996-07-22 | 1996-08-19 | 1996-07-25 | 3 | 48.29 | Rattlesnake Canyon Grocery | 2817 Milton Dr. | Albuquerque | NM | 87110 | USA |
| 10263 | ERNSH | 9 | 1996-07-23 | 1996-08-20 | 1996-07-31 | 3 | 146.06 | Ernst Handel | Kirchgasse 6 | Graz | NULL | 8010 | Austria |
| 10264 | FOLKO | 6 | 1996-07-24 | 1996-08-21 | 1996-08-23 | 3 | 3.67 | Folk och fä HB | Åkergatan 24 | Bräcke | NULL | S-844 67 | Sweden |
| 10265 | BLONP | 2 | 1996-07-25 | 1996-08-22 | 1996-08-12 | 1 | 55.28 | Blondel père et fils | 24, place Kléber | Strasbourg | NULL | 67000 | France |
| 10266 | WARTH | 3 | 1996-07-26 | 1996-09-06 | 1996-07-31 | 3 | 25.73 | Wartian Herkku | Torikatu 38 | Oulu | NULL | 90110 | Finland |
| 10267 | FRANK | 4 | 1996-07-29 | 1996-08-26 | 1996-08-06 | 1 | 208.58 | Frankenversand | Berliner Platz 43 | München | NULL | 80805 | Germany |
| 10268 | GROSR | 8 | 1996-07-30 | 1996-08-27 | 1996-08-02 | 3 | 66.29 | GROSELLA-Restaurante | 5ª Ave. Los Palos Grandes | Caracas | DF | 1081 | Venezuela |
| 10269 | WHITC | 5 | 1996-07-31 | 1996-08-14 | 1996-08-09 | 1 | 4.56 | White Clover Markets | 1029 - 12th Ave. S. | Seattle | WA | 98124 | USA |
| 10270 | WARTH | 1 | 1996-08-01 | 1996-08-29 | 1996-08-02 | 1 | 136.54 | Wartian Herkku | Torikatu 38 | Oulu | NULL | 90110 | Finland |
| 10271 | SPLIR | 6 | 1996-08-01 | 1996-08-29 | 1996-08-30 | 2 | 4.54 | Split Rail Beer & Ale | P.O. Box 555 | Lander | WY | 82520 | USA |
| 10272 | RATTC | 6 | 1996-08-02 | 1996-08-30 | 1996-08-06 | 2 | 98.03 | Rattlesnake Canyon Grocery | 2817 Milton Dr. | Albuquerque | NM | 87110 | USA |
Example queries
Row countsUNION ALL stacks five counts into one result.
Order Details columnspragma_table_info shows the two-column primary key.
Territories per employeeFour tables joined through a junction table.
Uncovered territoriesLEFT JOIN + IS NULL finds rows with no match.
Org chart (recursive)A recursive CTE walks the ReportsTo tree.
Price history of Queso CabralesOrder lines keep the price charged on the day.
IS NULLThe only reliable test for a missing value.
count(*) vs count(column)Why counting after a LEFT JOIN goes wrong.
Revenue by categoryGROUP BY with a derived revenue column.
Shipper performancejulianday() differences give days to ship.
Sales by quarterstrftime() and integer division make quarters.
Priciest product per categoryA correlated subquery, run per row.
Lost customersEXISTS and NOT EXISTS together.
Category Sales for 1997A view built on a view built on a view.
+ versus ||Why T-SQL string joins return 0 in SQLite.
Ten Most Expensive ProductsMicrosoft's procedure, as ORDER BY + LIMIT.
Rank within countryrank() OVER (PARTITION BY ...).
Running total by monthsum() OVER and lag() for month-on-month.
Top two products per categoryrow_number() for a top-N per group.
Plan: indexed lookupEXPLAIN QUERY PLAN: SEARCH via an index.
Plan: a joinA join that uses a covering index.
BLOB sizestypeof() and length() on stored pictures.
What you can't do here, and why
INSERT, UPDATE, DELETE, CREATE, DROP, ATTACH, BEGIN and any PRAGMA that changes a setting are all refused, because this is a shared demonstration. On your own copy everything works: download northwind.db and run sqlite3 northwind.db. Try DELETE FROM Orders; here to see the refusal.