The Northwind database is a sample database used by Microsoft to demonstrate the features of some of its products, including SQL Server and Microsoft Access. The database contains the sales data for Northwind Traders, a fictitious specialty foods export-import company.
Although the code taught in this class is not specific to Microsoft products, we use the Northwind database for many of our examples because many people are already familiar with it and because there are many resources for related learning that make use of the same database.
The diagram below shows the table structure of the Northwind database.
The Northwind database has additional tables, but we will only be using the ones shown above. In this lesson, we will explore some of these tables.
The standard SQL comment is two hyphens (
--). However, some databases
use other forms of comments as shown in the table below.
The code sample below shows some sample comments.
-- Single-line comment /* Multi-line comment used in: -SQL Server -Oracle -MySQL */
Whitespace is ignored in SQL statements. Multiple statements are separated with semi-colons. The two statements in the sample below are equally valid.
SELECT * FROM Employees; SELECT * FROM Employees;
SQL is not case sensitive. It is common practice to write reserved words in all capital letters. User-defined names, such as table names and column names may or may not be case sensitive depending on the operating system used.
The following syntax is used to retrieve all columns in all rows of a table.
SELECT table.* FROM table; -- OR SELECT * FROM table;
--Retrieve all columns in the Region table SELECT * FROM Region;
SELECT statement will return the following results:
As you can see, the
Region table has only two columns,
RegionDescription, and four rows.