30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

890 Database, SQL and ADO .<strong>NET</strong> Chapter 19<br />

Fig. 19.2 Result set formed by selecting Department and Location data<br />

from the Employee table.<br />

19.3 Relational Database Overview: Books Database<br />

This section provides an overview of SQL in the context of a sample Books database we<br />

created for this chapter. Before we discuss SQL, we explain the various tables of the<br />

Books database. We use this database <strong>to</strong> introduce various database concepts, including<br />

the use of SQL <strong>to</strong> manipulate and obtain useful information from the database. We provide<br />

a script <strong>to</strong> create the database, which is located in the Chapter 19 examples direc<strong>to</strong>ry on the<br />

CD that accompanies this book. Section 19.6 explains how <strong>to</strong> use this script.<br />

The database consists of four tables: Authors, Publishers, AuthorISBN and<br />

Titles. The Authors table (described in Fig. 19.3) consists of three fields (or columns)<br />

that maintain each author’s unique ID number, first name and last name. Figure 19.4 contains<br />

the data from the Authors table of the Books database.<br />

Field Description<br />

department location<br />

413 New Jersey<br />

611 Orlando<br />

642 Los Angeles<br />

authorID Author’s ID number in the database. In the Books database, this Integer<br />

field is defined as an au<strong>to</strong>-incremented field. For each new record inserted in<br />

this table, the database increments the authorID value, ensuring that each<br />

record has a unique authorID. This field represents the table’s primary key.<br />

firstName Author’s first name (a String).<br />

lastName Author’s last name (a String).<br />

Fig. 19.3 Authors table from Books.<br />

authorID firstName lastName<br />

1 Harvey Deitel<br />

2 Paul Deitel<br />

3 Tem Nie<strong>to</strong><br />

4 Kate Steinbuhler<br />

5 Sean Santry<br />

Fig. 19.4 Data from the Authors table of Books (part 1 of 2).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!