Datasheet
that doesn’t depend on the exact RDBMS you are using. However, in being standardized it suffers by not
giving access to proprietary features, and it is slower because its instructions must be translated into
native instructions.
In this book, you learn specifically about SQL Server 2005 data access with C#, using the Express Edition
for simplicity (and because it’s free to download and use). Please don’t assume that this prevents you
from learning to use other types of RDBMSes, however. In many cases, near identical code applies to
other RDBMSes — and this is noted in the book where appropriate.
How Do You Use a Database?
Databases are designed to be data stores that are independent of other factors, such as the programming
language you use to access them. With a few notable exceptions — CLR integration, for instance — you
can use them from any programming language, or even directly (via web requests, for example) in some
circumstances.
Early in the history of databases, moves were made to standardize database access. In more recent times
a standard has emerged (and undergone numerous revisions) — Structured Query Language (SQL). The
roots of this standard can be traced back to the 1970s, with the first accepted standard (SQL-86, pub-
lished in 1986) having now evolved into the most recent version, SQL:2003 (published, unsurprisingly
enough, in 2003). SQL is now ubiquitous, although every major RDBMS vendor still insists on including
its own proprietary “flavor” of the language. Having said that, the core commands and syntax are (more
or less) the same whatever RDBMS you use. Perhaps the only remaining controversy concerns how to
pronounce SQL — “see-quell” or “ess-que-ell”? Personally, I prefer the former, but feel free to differ.
At its heart, SQL is a human-readable language. In fact, without having any prior knowledge of it, you’ll
probably find it reasonably simple to understand in its basic form. For example, consider the following
SQL command:
SELECT PhoneNumber FROM PhoneBookEntry WHERE EntryName = ‘Geoffrey Chaucer’
So, what do the words that make up this command suggest? Well, it doesn’t take a huge amount of
working out to guess that this command will retrieve the contents of a
PhoneNumber column from a
database called
PhoneBookEntry for a row with an EntryName column that has a value of Geoffrey
Chaucer
. Admittedly, SELECT doesn’t appear to be the most obvious name of a command that would do
this (
GET or RETRIEVE might seem more appropriate), but don’t worry — you’ll get used to it. Later in
this section, you encounter a SQL primer that covers the basics of what the SQL language can achieve.
Luckily for those of us who don’t want to type in reams of SQL code to do anything with databases, most
RDBMSes come equipped with graphical tools for administration purposes. This isn’t the case with SQL
Server 2005 Express Edition, although you can inspect and administer it through the Visual C# 2005 Express
To work through the examples in this book, you need to install SQL Server 2005
Express Edition. You can find instructions for doing this in Appendix A, along with
instructions for installing the other Express products that are used in this book should
you not have them installed already.
17
Database Fundamentals
44063c01.qxd:WroxBeg 9/12/06 10:31 PM Page 17