| 1: || |
What is a database?
| A1: || |
A database is a collection of related data.
| 2: || |
What is the general structure of a database?
| A2: || |
Think of a database as a shell within which are one or more tables. Each table is comprised of columns , called fields. Each field represents a data item. Common field names might be SSN , FirstName , LastName , Address , City , State , and Zip . If you fill in each field for one row of the table, that row becomes a database record. Usually, the data that comprise each record is unique.
| 3: || |
What is a primary key and what is its purpose?
| A3: || |
A primary key is a field that has an unduplicated value for each record in the table. In some cases, the primary field is actually two fields. By having a unique primary key in one table, it's possible to use that key in other, related tables for purposes of searching the related tables. A common example of a primary key is a customer ID number in a Customer table, which can then be used to identify all purchases by the customer in the Orders table. In other words, the primary key in the Customer table is used to define a relationship between that table and the Orders table.
| 4: || |
Explain what the lines are that appear between the tables shown in Figure 24.1.
| A4: || |
The lines between the tables show how the primary keys are used in other tables. In each case, the primary key is displayed in boldface print. The lines represent how the tables are related to each other. For example, the field named Customer ID is the primary key in the Customer table. However, the Customer ID field is also present in the Orders table, and a line connects the field in the two tables. Therefore, we can search the Orders table and find who placed the order by following the Customer ID number in the Orders table back to the Customer table.
| 5: || |
Write an SQL statement that selects every customer from the Customers table who lives in the 46220 ZIP Code and presents them in alphabetical order based on their last name . You can assume that the field names are LastName and ZipCode .
| A5: || |
The SQL statement would be
SQL = "SELECT LastName,ZipCode FROM Customers WHERE " SQL += "ZipCode = 46220 ORDER BY LastName"
| 6: || |
What is the primary purpose of the Connection object?
| A6: || |
The purpose of the Connection object is to provide the information necessary to establish a link between Visual Basic .NET and the database. The two most important properties of the Connection object are the Provider and Data Source parameters of the connect string. These two parameters tell the type of database being used and where to find it.
| 7: || |
What is the purpose of the Data Adapter object?
| A7: || |
The Data Adapter object enables us to control the data associated with the database. It is from the Data Adapter that we derive the datasets that contain the actual data used in a program.