Wiley 978-0-470-04406-3 Datenblatt

Stöbern Sie online oder laden Sie Datenblatt nach Software-Handbücher Wiley 978-0-470-04406-3 herunter. Wiley Beginning C# 2005 Databases Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 34
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 0
1
Database Fundamentals
Before you start to look at accessing databases from C# code, there are a few basics that you need
to know. It is necessary to have a formal definition of what is meant by the term database, and
that’s the first thing you examine in this chapter. Once you have this definition, you look in more
depth at the features that databases (and, more specifically, database management systems) offer,
and see the difference between relational and object-oriented database management systems.
Next, you investigate many of the commonly used database management systems. Finally, you
are introduced to the language used to manipulate databases, Structured Query Language (SQL).
Along the way you learn the terminology used by databases, see how databases may be repre-
sented graphically, and get your first look at the database management system used in this
book — SQL Server 2005 Express Edition.
If you’ve had any previous experience with databases, you may find that you are already familiar
with much of the material in this chapter. However, this information has been included so you can
avoid any ambiguities and common misconceptions that might cause problems later. Whatever
your level of experience, it is well worth recapping the basics to ensure a strong foundation of
knowledge for later chapters, and this chapter will also serve as a reference for you later on.
Remember, get a firm grasp of the basics and the rest will come easily.
In this chapter, you learn:
What databases are
The terminology used for databases
The features are offered by database management systems
What database management systems are available
How to manipulate data in a database
44063c01.qxd:WroxBeg 9/12/06 10:30 PM Page 1
COPYRIGHTED MATERIAL
Seitenansicht 0
1 2 3 4 5 6 ... 33 34

Inhaltsverzeichnis

Seite 1 - COPYRIGHTED MATERIAL

1Database FundamentalsBefore you start to look at accessing databases from C# code, there are a few basics that you needto know. It is necessary to ha

Seite 2 - What Is a Database?

in this way, the DBMS is capable of optimizing things further for you. It might, for example, cache viewdata so that retrieving its compound informati

Seite 3

IndexesIndexes are another way of optimizing performance by letting the DBMS know how you intend to makeuse of data. An index is an internally maintai

Seite 4

their usual account details, and this login is then forwarded on to the database by any applications thatare used. An advantage here is that at no poi

Seite 5

that the DBMS is unaware of whether rows are “checked out” at any given time, which makes it impos-sible to implement pessimistic concurrency control.

Seite 6

BackupsAfter the key tasks of being able to add, edit, and delete data in a database, perhaps the most importantfunction of a DBMS is to enable you to

Seite 7

A good management tool does far more than let you look at and edit data in tables. It enables you to cre-ate and manage databases, configure backups,

Seite 8

DB2, Oracle, and SQL ServerDB2, Oracle, and SQL Server are the three RDBMS heavy-hitters of the database world. DB2 (www-306.ibm.com/software/data/db2

Seite 9 - Functions

that doesn’t depend on the exact RDBMS you are using. However, in being standardized it suffers by notgiving access to proprietary features, and it is

Seite 10 - Triggers

Edition interface. In addition, there is a free tool — Microsoft SQL Server Management Studio Express —that mimics the more advanced administration to

Seite 11 - Security

statement, for example. SQL statements are often made up of several parts, which are known as clauses.SQL statements may also contain embedded (nested

Seite 12 - Concurrency Control

What Is a Database?It’s fair to say that most computing applications make use of data in one form or another, whether in anobvious way or with more su

Seite 13 - Remote Access

It is worth noting that this shorthand notation can result in some (minor) overhead and reduction in per-formance because the RDBMS must work out what

Seite 14 - Management Tools

useful in different circumstances. Briefly, the types of join you can perform are as follows (don’t worrytoo much about these definitions at this stag

Seite 15 - What RDBMSes Are Available?

Figure 1-7: Result of a cross join between Product and ProductCategory tablesThere are six results because every row in Product (3) is combined with e

Seite 16 - DB2, Oracle, and SQL Server

Adding a where clause identical to the one used earlier for the cross-join query would result in a singlerow being returned — row 2 in Figure 1-8.Inne

Seite 17 - How Do You Use a Database?

You’ll return to inner joins in subsequent chapters. One last note for now: It is possible to use operatorsother than = to join tables. For numeric fi

Seite 18 - A SQL Primer

This time, the result set is different, as shown in Figure 1-11.Figure 1-11: The result of a right outer join between Product and ProductCategory base

Seite 19 - Database Fundamentals

This may be simple, but there are several points to note:❑ The INTO keyword is optional, but it makes the query easier to read. If you want, however,

Seite 20 - Chapter 1

The INSERT keyword can also be used to insert multiple columns into a table at the same time. However,this cannot be achieved by specifying all of the

Seite 21

This query would delete all the rows from a table called ProductA that didn’t have ProductName valuesthat started with the letter A. Here’s another ex

Seite 22

For example, the following command, CREATE DATABASE, would create a new database within the DBMS:CREATE DATABASE MyDatabaseOfWondersOnce created, you

Seite 23

scenario does not apply. If you have a phone number and want to know to whom it belongs, you won’tfind a phone book particularly useful. While it is t

Seite 24

Then you would add the foreign key, in the form of another constraint:ALTER TABLE [dbo].[Product] WITH CHECK ADD CONSTRAINT [FK_Product_ProductCategor

Seite 25

The markup in XML documents consists of data enclosed in elements, where that data may consist ofnested (child) elements. Every XML document contains

Seite 26

Storing XML DataIn the XML document shown in the previous section, it is fairly obvious how the data might map to adatabase table. For instance, you c

Seite 27

<Product ProductId=”9F71EFA0-9790-11DA-A72B-0800200C9A66”ProductName=”Gadget” ProductCost=”20.0000”ProductCategoryId=”914FC5A0-9790-11DA-A72B-08002

Seite 28

Exercises1. Database tables must include primary keys. Is this statement true or false?2. Which of the following are actual types of joins between tab

Seite 29

The following sections examine tables; relationships; an important property of relational databases thatemerges from these constraints — normalization

Seite 30

KeysWithin database tables it is often important to uniquely identify rows, especially when defining relation-ships. The position of a row isn’t enoug

Seite 31

both important and extremely useful. For example, in a sales database you might want to record boththe products on sale and the orders placed for prod

Seite 32

Figure 1-3: The PhoneBookEntry table with a primary keyShowing one-to-many links as a line with a key at one end and linked circles at the other (the

Seite 33

Object Oriented Database Management SystemsThere are some situations where the integration between applications and databases must be farstronger than

Seite 34 - Exercises

In this section you look at each of these, getting a flavor for them but without going into too much depthat this stage.JoinsIn the earlier relationsh

Kommentare zu diesen Handbüchern

Keine Kommentare