Table 7.6. The HelpDeskStatus table
Primary KeyAllow NullIdentitySQL Data TypeColumn Name
YesNoYesintStatusID
NoNoNonvarchar(50)Status
Using SQL Scripts
Yep, there’s a lot of data to type in! While we recommend that you create
the tables yourself by defining the fields outlined here, you can achieve the
same goal using an SQL script that’s included in this book’s code archive.
This script contains SQL code that SQL Server understands, and contains
instructions that create data structures (you’ll learn about SQL in Chapter 8).
If you want to use the downloadable script, we recommend you have a look
over the following tables to get an idea of the structures we’ll be creating,
then read the section called “Executing SQL Scripts” that follows.
We already have a clear idea of the data we’ll store in the Employees and Depart-
ments tables. The other tables will be used to store help desk requests; we’ll discuss
these in more detail in the following pages.
Executing SQL Scripts
If you prefer not to create the data tables manually, you can use the Creat-
eTables.sql script included in the book’s code archive to create the tables for
you. This script is most easily used with SQL Server Management Studio. After
you log in, click the New Query button on the toolbar (or select File > New >
Query with Current Connection). Paste the contents of the CreateTables.sql
script into the window that opens, and press F5 to execute the commands. Note
that if you have already created the Employees table, you should remove the
CREATE TABLE command that creates this table before you hit F5.
The SQL scripts included in the code archive contains all the commands required
for this entire chapter—it even creates the sample data and table references that
are covered later.
Populating the Data Tables
If tables represent drawers in a filing cabinet, rows represent individual paper
records in those drawers. Suppose that our intranet web application was a real
application. As people begin to register and interact with the application, rows
272
Chapter 7: Database Design and Development