Workshop


Quiz

1.

How are columns, tables, and databases related to one another?

2.

A particular column for a particular row in a database table is a lot like a variable in a programming language in that it can be completely described by what three attributes?

3.

What does a Null value represent?

4.

How does an Auto-increment primary key column guarantee that it will uniquely identify each row?

5.

True or False: When you create a database table, the table must have a primary key column.

Answers

1.

A table contains one or more columns. A database contains one or more tables.

2.

The column name, the column data type, and the value of the column for the specific row.

3.

A Null value represents unknown or no value. For example, in the Books database, the LastReadOn column accepts Null values because we might not have read the book yet, in which case there is no value for this column.

4.

When you insert a new row into a column with an Auto-increment primary key column, the database server decides the value of the Auto-increment primary key column. Because the database server gets to determine this value, it can ensure that the value is unique from all other rows. This is accomplished by incrementing the Auto-increment primary key column value from the last-inserted row.

5.

False. The vast majority of the time you will want your tables to include a primary key, Auto-increment column, but you can create tables without a primary key.

Exercises

  1. To familiarize yourself with Visual Web Developer and SQL Server 2005 Express Edition, create a new database named TestDB. After creating the database, create a new database table called Albums. Imagine that you want to use this database table to hold information about the albums you own. Add columns with appropriate types and names. Some suggested columns include: an Auto-increment primary key column named AlbumID; an nvarchar(50) column titled Name; an nvarchar(75) column titled Artist; and a date/time column titled DatePurchased. (Take the time to add additional pertinent columns.)

  2. In the "Storing Structured Data" section, we talked about a Customers table that captured information about potential customers, such as their name, phone number, ZIP code, and so on (refer to Figure 13.1). Take a moment to create this database table with the appropriate schema. Next, add the five records detailed in Figure 13.2.




Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net