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
| SupplierID | CompanyName | ContactName | ContactTitle | Address | City | Region | PostalCode | Country | Phone | Fax | HomePage |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Exotic Liquids | Charlotte Cooper | Purchasing Manager | 49 Gilbert St. | London | NULL | EC1 4SD | UK | (171) 555-2222 | NULL | NULL |
| 2 | New Orleans Cajun Delights | Shelley Burke | Order Administrator | P.O. Box 78934 | New Orleans | LA | 70117 | USA | (100) 555-4822 | NULL | #CAJUN.HTM# |
| 3 | Grandma Kelly's Homestead | Regina Murphy | Sales Representative | 707 Oxford Rd. | Ann Arbor | MI | 48104 | USA | (313) 555-5735 | (313) 555-3349 | NULL |
| 4 | Tokyo Traders | Yoshi Nagase | Marketing Manager | 9-8 Sekimai Musashino-shi | Tokyo | NULL | 100 | Japan | (03) 3555-5011 | NULL | NULL |
| 5 | Cooperativa de Quesos 'Las Cabras' | Antonio del Valle Saavedra | Export Administrator | Calle del Rosal 4 | Oviedo | Asturias | 33007 | Spain | (98) 598 76 54 | NULL | NULL |
| 6 | Mayumi's | Mayumi Ohno | Marketing Representative | 92 Setsuko Chuo-ku | Osaka | NULL | 545 | Japan | (06) 431-7877 | NULL | Mayumi's (on the World Wide Web)#http://www.microsoft.com/accessdev/sampleapps/mayumi.htm# |
| 7 | Pavlova, Ltd. | Ian Devling | Marketing Manager | 74 Rose St. Moonie Ponds | Melbourne | Victoria | 3058 | Australia | (03) 444-2343 | (03) 444-6588 | NULL |
| 8 | Specialty Biscuits, Ltd. | Peter Wilson | Sales Representative | 29 King's Way | Manchester | NULL | M14 GSD | UK | (161) 555-4448 | NULL | NULL |
| 9 | PB Knäckebröd AB | Lars Peterson | Sales Agent | Kaloadagatan 13 | Göteborg | NULL | S-345 67 | Sweden | 031-987 65 43 | 031-987 65 91 | NULL |
| 10 | Refrescos Americanas LTDA | Carlos Diaz | Marketing Manager | Av. das Americanas 12.890 | Sao Paulo | NULL | 5442 | Brazil | (11) 555 4640 | NULL | NULL |
| 11 | Heli Süßwaren GmbH & Co. KG | Petra Winkler | Sales Manager | Tiergartenstraße 5 | Berlin | NULL | 10785 | Germany | (010) 9984510 | NULL | NULL |
| 12 | Plutzer Lebensmittelgroßmärkte AG | Martin Bein | International Marketing Mgr. | Bogenallee 51 | Frankfurt | NULL | 60439 | Germany | (069) 992755 | NULL | Plutzer (on the World Wide Web)#http://www.microsoft.com/accessdev/sampleapps/plutzer.htm# |
| 13 | Nord-Ost-Fisch Handelsgesellschaft mbH | Sven Petersen | Coordinator Foreign Markets | Frahmredder 112a | Cuxhaven | NULL | 27478 | Germany | (04721) 8713 | (04721) 8714 | NULL |
| 14 | Formaggi Fortini s.r.l. | Elio Rossi | Sales Representative | Viale Dante, 75 | Ravenna | NULL | 48100 | Italy | (0544) 60323 | (0544) 60603 | #FORMAGGI.HTM# |
| 15 | Norske Meierier | Beate Vileid | Marketing Manager | Hatlevegen 5 | Sandvika | NULL | 1320 | Norway | (0)2-953010 | NULL | NULL |
| 16 | Bigfoot Breweries | Cheryl Saylor | Regional Account Rep. | 3400 - 8th Avenue Suite 210 | Bend | OR | 97101 | USA | (503) 555-9931 | NULL | NULL |
| 17 | Svensk Sjöföda AB | Michael Björn | Sales Representative | Brovallavägen 231 | Stockholm | NULL | S-123 45 | Sweden | 08-123 45 67 | NULL | NULL |
| 18 | Aux joyeux ecclésiastiques | Guylène Nodier | Sales Manager | 203, Rue des Francs-Bourgeois | Paris | NULL | 75004 | France | (1) 03.83.00.68 | (1) 03.83.00.62 | NULL |
| 19 | New England Seafood Cannery | Robb Merchant | Wholesale Account Agent | Order Processing Dept. 2100 Paul Revere Blvd. | Boston | MA | 02134 | USA | (617) 555-3267 | (617) 555-3389 | NULL |
| 20 | Leka Trading | Chandra Leka | Owner | 471 Serangoon Loop, Suite #402 | Singapore | NULL | 0512 | Singapore | 555-8787 | NULL | NULL |
| 21 | Lyngbysild | Niels Petersen | Sales Manager | Lyngbysild Fiskebakken 10 | Lyngby | NULL | 2800 | Denmark | 43844108 | 43844115 | NULL |
| 22 | Zaanse Snoepfabriek | Dirk Luchte | Accounting Manager | Verkoop Rijnweg 22 | Zaandam | NULL | 9999 ZZ | Netherlands | (12345) 1212 | (12345) 1210 | NULL |
| 23 | Karkki Oy | Anne Heikkonen | Product Manager | Valtakatu 12 | Lappeenranta | NULL | 53120 | Finland | (953) 10956 | NULL | NULL |
| 24 | G'day, Mate | Wendy Mackenzie | Sales Representative | 170 Prince Edward Parade Hunter's Hill | Sydney | NSW | 2042 | Australia | (02) 555-5914 | (02) 555-4873 | G'day Mate (on the World Wide Web)#http://www.microsoft.com/accessdev/sampleapps/gdaymate.htm# |
| 25 | Ma Maison | Jean-Guy Lauzon | Marketing Manager | 2960 Rue St. Laurent | Montréal | Québec | H1J 1C3 | Canada | (514) 555-9022 | NULL | NULL |
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.