
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
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
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
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
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.
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
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,
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
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
Edition interface. In addition, there is a free tool — Microsoft SQL Server Management Studio Express —that mimics the more advanced administration to
statement, for example. SQL statements are often made up of several parts, which are known as clauses.SQL statements may also contain embedded (nested
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
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
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
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
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
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
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
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,
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
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
For example, the following command, CREATE DATABASE, would create a new database within the DBMS:CREATE DATABASE MyDatabaseOfWondersOnce created, you
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
Then you would add the foreign key, in the form of another constraint:ALTER TABLE [dbo].[Product] WITH CHECK ADD CONSTRAINT [FK_Product_ProductCategor
The markup in XML documents consists of data enclosed in elements, where that data may consist ofnested (child) elements. Every XML document contains
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
<Product ProductId=”9F71EFA0-9790-11DA-A72B-0800200C9A66”ProductName=”Gadget” ProductCost=”20.0000”ProductCategoryId=”914FC5A0-9790-11DA-A72B-08002
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
The following sections examine tables; relationships; an important property of relational databases thatemerges from these constraints — normalization
KeysWithin database tables it is often important to uniquely identify rows, especially when defining relation-ships. The position of a row isn’t enoug
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
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
Object Oriented Database Management SystemsThere are some situations where the integration between applications and databases must be farstronger than
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