Chapter 4: Relational Database Tables and XML

Overview

This book is essentially about XML and databases. In other words, how can XML documents be used with a relational database? XML can be stored in a database as an XML document or as a text document, and can even perhaps be built into table structures. An XML document is a repository for data. A database is also a repository for data. Therefore, it makes perfect sense to state that the two are one and the same in some respects.

Previous chapters have dealt purely with XML and various ways of handling XML documents. Those methods of handling XML documents are completely unrelated to a relational database. This chapter begins by changing the direction of this book completely, examining how data is accessed within a relational database without using XML. That topic is SQL (Structured Query Language). SQL is a language used for reading data from a relational database. Additionally, when writing data to a relational database, special commands are used. These commands in their most basic forms are known as INSERT , UPDATE , and DELETE commands.

In short, because youve dealt with the basics of XML, the beginning of this chapter deals with the basics of accessing a relational database, without any involvement of XML at all. The latter part of this chapter then takes what has been covered in the previous chapters (XML, the XML DOM, XSL) and applies it to relational database technology (using SQL). The result will be access of a relational database to both produce XML documents and edit XML documents to change relational database content.

In this chapter you learn about:

  • What a query is

  • How to use the SELECT statement

  • Filtering records with the WHERE clause

  • Sorting records with the ORDER BY clause

  • Summarizing records with the GROUP BY clause

  • Getting records from two tables with the JOIN clause

  • Nesting SELECT statements as subqueries

  • Merging two record sets with the UNION clause

  • How to change data in a database

  • How to generate XML documents using basic SQL



Beginning XML Databases
Beginning XML Databases (Wrox Beginning Guides)
ISBN: 0471791202
EAN: 2147483647
Year: 2006
Pages: 183
Authors: Gavin Powell

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