0% found this document useful (0 votes)
272 views2 pages

Practice Exercises: Doctype Element Element Element Element Pcdata Pcdata

This document provides practice exercises for Chapter 30 on XML. The exercises include writing XQuery queries on XML representations to find total instructor salaries and compute left outer joins, outputting courses with nested instructors, mapping a bibliographic DTD to a relational schema, representing an XML data tree, and mapping a recursive DTD to a relational schema and XML Schema.

Uploaded by

Divyanshu Bose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
272 views2 pages

Practice Exercises: Doctype Element Element Element Element Pcdata Pcdata

This document provides practice exercises for Chapter 30 on XML. The exercises include writing XQuery queries on XML representations to find total instructor salaries and compute left outer joins, outputting courses with nested instructors, mapping a bibliographic DTD to a relational schema, representing an XML data tree, and mapping a recursive DTD to a relational schema and XML Schema.

Uploaded by

Divyanshu Bose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CHAPTER

30
XML

Solutions for the Practice Exercises of Chapter 30

Practice Exercises

30.1 Write a query in XQuery on the XML representation in Figure 30.11 to find the
total salary of all instructors in each department.
30.2 Write a query in XQuery on the XML representation in Figure 30.1 to compute
the left outer join of department elements with course elements. (Hint: Use
universal quantification.)
30.3 Write queries in XQuery to output course elements with associated instructor
elements nested within the course elements, given the university information
representation using ID and IDREFS in Figure 30.11.
30.4 Give a relational schema to represent bibliographical information specified
according to the DTD fragment shown below:

<!DOCTYPE bibliography [
<!ELEMENT book (title, author+, year, publisher, place?)>
<!ELEMENT article (title, author+, journal, year, number, volume, pages?)>
<!ELEMENT author ( last name, first name) >
<!ELEMENT title ( #PCDATA )>
⋯ similar PCDATA declarations for year, publisher, place, journal, year,
number, volume, pages, last name and first name
]>

The relational schema must keep track of the order of author elements. You
can assume that only books and articles appear as top-level elements in XML
documents.
11
12 Chapter 30 XML

30.5 Show the tree representation of the XML data in Figure 30.1, and the represen-
tation of the tree using nodes and child relations described in Section 30.6.2.
30.6 Consider the following recursive DTD:
<!DOCTYPE parts [
<!ELEMENT part (name, subpartinfo*)>
<!ELEMENT subpartinfo (part, quantity)>
<!ELEMENT name ( #PCDATA )>
<!ELEMENT quantity ( #PCDATA )>
]>

a. Show how to map this DTD to a relational schema. You can assume
that part names are unique; that is, wherever a part appears, its subpart
structure will be the same.
b. Create a schema in XML Schema corresponding to this DTD.

You might also like