Saturday, September 22, 2007

aaaaa

ur examples of database systems other than those listed in Section 1.1.

Some examples could be:

o A system that maintains component part details for a car manufacturer;
o An advertising company keeping details of all clients and adverts placed with them;
o A training company keeping course information and participants’ details;
o An organization maintaining all sales order information.



1.2 Discuss each of the following terms:

Data For end users, this constitutes all the different values connected with the various objects/entities that are of concern to them. (See also Section 1.3.3.)

Database (See Section 1.3.1.)

Database Management System (See Section 1.3.2.)

Data Independence This is essentially the separation of underlying file structures from the programs that operate on them, also called program-data independence. (See also Sections 1.2.2 and 1.3.1.)

Security The protection of the database from unauthorized users, which may involve passwords and access restrictions. (See also Section 1.6.)

Integrity The maintenance of the validity and consistency of the database by use of particular constraints that are applied to the data. (See also Section 1.6.)

Views These present only a subset of the database that is of particular interest to a user. Views can be customized, for example, field names may change, and they also provide a level of security preventing users from seeing certain data. (See also Section 1.3.2.)

1.3 Describe the approach taken to the handling of data in the early file-based systems. Discuss the disadvantages of this approach.

Focus was on applications for which programs would be written, and all the data required would be stored in a file or files owned by the programs. (See also Section 1.2.)

Clearly, each program was responsible for only its own data, which could be repeated in other program’s data files. Different programs could be written in different languages, and would not be able to access another program’s files. This would be true even for those programs written in the same language, because a program needs to know the file structure before it can access it. (See also Section 1.2.2.)

1.4 Describe the main characteristics of the database approach and contrast it with the file-based approach.

Focus is now on the data first, and then the applications. The structure of the data is now kept separate from the programs that operate on the data. This is held in the system catalog or data dictionary. Programs can now share data, which is no longer fragmented. There is also a reduction in redundancy, and achievement of program-data independence. (See also Section 1.3.)

1.5 Describe the five components of the DBMS environment and discuss how they relate to each other.

See Section 1.3.3.

1.6 Discuss the roles of the following personnel in the database environment:

Data Administrator See Section 1.4.1

Database Administrator See Section 1.4.1

Logical Database Designer See Section 1.4.2

Physical Database Designer See Section 1.4.2

Application Developer See Section 1.4.3

End-Users See Section 1.4.4

1.7 Discuss the advantages and disadvantages of database management systems.

See Section 1.6.


Chapter 2 Database Environment
Review Questions


2.1 Discuss the concept of data independence and explain its importance in a database environment.

See Section 2.1.5.

2.2 To address the issue of data independence, the ANSI-SPARC three-level architecture was proposed. Compare and contrast the three levels of this model.

See Section 2.1.

2.3 What is a data model? Discuss the main types of data models.

An integrated collection of concepts for describing and manipulating data, relationships between data, and constraints on the data in an organization. (See Section 2.3.)

Object-based data models such as the Entity–Relationship model (see Section 2.3.1). Record-based data models such as the relational data model, network data model, and hierarchical data model (see Section 2.3.2). Physical data models describe how data is stored in the computer (see Section 2.3.3).

2.4 Discuss the function and importance of conceptual modeling.

See Section 2.3.4.

2.5 Describe the types of facility you would expect to be provided in a multi-user DBMS.

Data Storage, Retrieval and Update Authorization Services

A User-Accessible Catalog Support for Data Communication

Transaction Support Integrity Services

Concurrency Control Services Services to Promote Data Independence

Recovery Services Utility Services

See also Section 2.4.

2.6 Of the facilities described in your answer to Question 2.5, which ones do you think would not be needed in a standalone PC DBMS? Provide justification for your answer.

Concurrency Control Services – only single user.

Authorization Services – only single user, but may be needed if different individuals are to use the DBMS at different times.

Utility Services – limited in scope.

Support for Data Communication – only standalone system.

2.7 Describe the main components in a DBMS and suggest which components are responsible for each facility identified in Question 2.5.

Query Processor, DML Preprocessor, Data Storage, Retrieval and

Query Optimizer, Data Manager Update

Dictionary Manager A User-Accessible Catalog

Transaction Manager Transaction Support

Scheduler Concurrency Control Services

Data Manager Recovery Services

Authorization Control Authorization Services

Database Manager Support for Data Communication

Integrity Checker Integrity Services

Database Manager, DDL Compiler,

File Manager Services to Promote Data Independence

Utilities Utility Services

See also Sections 2.4 and 2.5.

2.8 What is meant by the term ‘client–server architecture’ and what are the advantages of this approach? Compare the client–server architecture with two other architectures.

The client is a process that requires some resource, and the server provides the resource. Neither need reside on the same machine. Advantages include:

o Better performance
o Likely reduction in hardware costs
o Reduction in communication costs
o Better consistency



See also Section 2.6.

9. What is a TP Monitor? What advantages does a TP Monitor bring to an OLTP environment?



A program that controls data transfer between clients and servers in order to provide a consistent environment, particularly for online transaction processing (OLTP).

o Transaction routing
o Managing distributed transactions
o Load balancing
o Funneling
o Increased reliability



See also Section 2.6.

2.10 Discuss the function and importance of the system catalog.

See Section 2.7.




Chapter 3 The Relational Model
Review Questions


3.1 Discuss each of the following concepts in the context of the relational data model:

(a) Relation

(b) Attribute

(c) Domain

(d) Tuple

(e) Intension and Extension

(f) Degree and Cardinality

Each term defined in Section 3.2.1.

3.2 Describe the relationship between mathematical relations and relations in the relational data model?

Let D1, D2, . . . , Dn be n sets. Their Cartesian product is defined as:

D1 × D2 × . . . × Dn = {(d1, d2, . . . , dn) | d1 ∈ D1, d2 ∈ D2, . . . , dn ∈ Dn}

Any set of n-tuples from this Cartesian product is a relation on the n sets. Now let A1, A2, . . ., An be attributes with domains D1, D2, . . . , Dn. Then the set {A1:D1, A2:D2, . . . , An:Dn} is a relation schema. A relation R defined by a relation schema S is a set of mappings from the attribute names to their corresponding domains. Thus, relation R is a set of n-tuples:

(A1:d1, A2:d2, . . . , An:dn) such that d1 ∈ D1, d2 ∈ D2, . . . , dn ∈ Dn

Each element in the n-tuple consists of an attribute and a value for that attribute.

Discussed fully in Sections 3.2.2 and 3.2.3.

3.3 Describe the differences between a relation and a relation schema. What is a relational database schema?

A relation schema is a named relation defined by a set of attribute and domain name pairs. A relational database schema is a set of relation schemas, each with a distinct name. Discussed in Section 3.2.3.

3.4 Discuss the properties of a relation.

A relation has the following properties:

• has a name that is distinct from all other relation names in the relational schema;

• each cell contains exactly one atomic (single) value;

• each attribute has a distinct name;

• the values of an attribute are all from the same domain;

• each tuple is distinct; there are no duplicate tuples;

• the order of attributes has no significance;

• the order of tuples has no significance, theoretically. (However, in practice, the order may affect the efficiency of accessing tuples.)

Discussed fully in Section 3.2.4.

3.5 Discuss the differences between the candidate keys and the primary key of a relation. Explain what is meant by a foreign key. How do foreign keys of relations relate to candidate keys? Give examples to illustrate your answer.

The primary key is the candidate key that is selected to identify tuples uniquely within a relation. A foreign key is an attribute or set of attributes within one relation that matches the candidate key of some (possibly the same) relation. Discussed in Section 3.2.5.

3.6 Define the two principal integrity rules for the relational model. Discuss why it is desirable to enforce these rules.

Two rules are Entity Integrity (Section 3.3.2) and Referential Integrity (Section 3.3.3).

3.7 What is a view? Discuss the difference between a view and a base relation.

View is the dynamic result of one or more relational operations operating on the base relations to produce another relation. Base relation exists as a set of data in the database. A view does not contain any data, rather a view is defined as a query on one or more base relations and a query on the view is translated into a query on the associated base relations.


Chapter 4 Relational Algebra and Relational Calculus
Review Questions

4.1 What is the difference between a procedural and non-procedural language? How would you classify the relational algebra and relational calculus?

Procedural language: a language that allows user to tell the system what data is needed and exactly how to retrieve the data.

Non-procedural language: a language that allows user to state what data is needed rather than how it is to be retrieved.

Informally, we may describe the relational algebra as a (high-level) procedural language: it can be used to tell the DBMS how to build a new relation from one or more relations in the database. Again, informally, we may describe the relational calculus as a non-procedural language: it can be used to formulate the definition of a relation in terms of one or more database relations.

4.2 Explain the following terms:

o relationally complete;



A language that can be used to produce any relation that can be derived using the relational calculus is said to be relationally complete.

o closure of relational operations.



The relational algebra is a theoretical language with operations that work on one or more relations to define another relation without changing the original relation(s). Thus, both the operands and the results are relations, and so the output from one operation can become the input to another operation. This allows expressions to be nested in the relational algebra, just as we can nest arithmetic operations. This property is called closure: relations are closed under the algebra, just as numbers are closed under arithmetic operations.

4.3 Define the five basic relational algebra operations. Define the Join, Intersection, and Division operations in terms of these five basic operations.

Five basic operations are:

o Selection and Projection (Unary)
o Cartesian Product, Union and Set Difference (Binary).



There is also the Join, Intersection, and Division operations:

o Can rewrite Theta join in terms of the basic selection and Cartesian product operations:



R 3 F S = σF (R × S)

o Can express the intersection operation in terms of the set difference operation:



R ∩ S = R – (R – S)

o Can express the division operation in terms of the basic operations:



T1 = ΠC(R)

T2 = ΠC( (S × T1) – R)

T = T1 – T2

4.4 Discuss the differences between the five Join operations: Theta join, Equijoin, Natural join, Outer join, and Semijoin. Give examples to illustrate your answer.

Theta join R 3F S Produces a relation that contains tuples satisfying the predicate F from the Cartesian product of R and S.
Equijoin R 3F S Produces a relation that contains tuples satisfying the predicate F (which only contains equality comparisons) from the Cartesian product of R and S.
Natural join R 3 S An Equijoin of the two relations R and S over all common attributes x. One occurrence of each common attribute is eliminated.
(Left) Outer join R 5 S A join in which tuples from R that do not have matching values in the common attributes of S are also included in the result relation.
Semijoin R 1F S Produces a relation that contains the tuples of R that participate in the join of R with S.



4.5 Compare and contrast the tuple relational calculus with domain relational calculus. In particular, discuss the distinction between tuple and domain variables.

In the tuple relational calculus, we use variables that range over tuples in a relation. In the domain relational calculus, we also use variables but in this case the variables take their values from domains of attributes rather than tuples of relations.

4.6 Define the structure of a (well-formed) formula in both the tuple relational calculus and domain relational calculus.

Tuple relational calculus

A (well-formed) formula is made out of one or more atoms, where an atom has one of the following forms:

* R(Si), where Si is a tuple variable and R is a relation.
* Si.a1 θ Sj.a2, where Si and Sj are tuple variables, a1 is an attribute of the relation over which Si ranges, a2 is an attribute of the relation over which Sj ranges, and θ is one of the comparison operators (<, ≤ , >, ≥ , =, ≠); the attributes a1 and a2 must have domains whose members can be compared by θ.

o Si.a1 θ c, where Si is a tuple variable, a1 is an attribute of the relation over which Si ranges, c is a constant from the domain of attribute a1, and θ is one of the comparison operators.

We recursively build up formulae from atoms using the following rules:

o an atom is a formula;
o if F1 and F2 are formulae, so are their conjunction F1 ∧ F2, their disjunction F1 ∨ F2, and the negation ~F1;
o if F is a formula with free variable X, then (∃X)(F) and (∀X)(F) are also formulae.



Domain relational calculus

A (well-formed) formula is made out of one or more atoms, where an atom has one of the following forms:

o R(d1, d2,…, dn), where R is a relation of degree n and each di is a domain variable.
o di θ dj, where di and dj are domain variables and θ is one of the comparison operators (<, ≤ , >, ≥ , =, ≠); the domains di and dj must have members that can be compared by θ.
o di θ c, where di is a domain variable, c is a constant from the domain of di, and θ is one of the comparison operators.



4.7 Explain how a relational calculus expression can be unsafe? Illustrate your answer with an example. Discuss how to ensure that a relational calculus expression is safe.

See end of Section 4.2.1.


Chapter 5 SQL: Data Manipulation
Review Questions


5.1 What are the two major components of SQL and what function do they serve?

A data definition language (DDL) for defining the database structure.

A data manipulation language (DML) for retrieving and updating data.

5.2 What are the advantages and disadvantages of SQL?

Advantages

o Satisfies ideals for database language
o (Relatively) Easy to learn
o Portability
o SQL standard exists
o Both interactive and embedded access
o Can be used by specialist and non-specialist.



Disadvantages

o Impedance mismatch – mixing programming paradigms with embedded access
o Lack of orthogonality – many different ways to express some queries
o Language is becoming enormous (SQL-92 is 6 times larger than predecessor)
o Handling of nulls in aggregate functions
o Result tables are not strictly relational – can contain duplicate tuples, imposes an ordering on both columns and rows.



5.3 Explain the function of each of the clauses in the SELECT statement. What restrictions are imposed on these clauses?

FROM Specifies the table or tables to be used.

WHERE Filters the rows subject to some condition.

GROUP BY Forms groups of rows with the same column value.

HAVING Filters the groups subject to some condition.

SELECT Specifies which columns are to appear in the output.

ORDER BY Specifies the order of the output.

If the SELECT list includes an aggregate function and no GROUP BY clause is being used to group data together, then no item in the SELECT list can include any reference to a column unless that column is the argument to an aggregate function.

When GROUP BY is used, each item in the SELECT list must be single-valued per group. Further, the SELECT clause may only contain:

o Column names.
o Aggregate functions.
o Constants.
o An expression involving combinations of the above.



All column names in the SELECT list must appear in the GROUP BY clause unless the name is used only in an aggregate function.

5.4 What restrictions apply to the use of the aggregate functions within the SELECT statement? How do nulls affect the aggregate functions?

An aggregate function can be used only in the SELECT list and in the HAVING clause.

Apart from COUNT(*), each function eliminates nulls first and operates only on the remaining non-null values. COUNT(*) counts all the rows of a table, regardless of whether nulls or duplicate values occur.

5.5 Explain how the GROUP BY clause works. What is the difference between the WHERE and HAVING clauses?

SQL first applies the WHERE clause. Then it conceptually arranges the table based on the grouping column(s). Next, applies the HAVING clause and finally orders the result according to the ORDER BY clause.

WHERE filters rows subject to some condition; HAVING filters groups subject to some condition.

5.6 What is the difference between a subquery and a join? Under what circumstances would you not be able to use a subquery?

With a subquery, the columns specified in the SELECT list are restricted to one table. Thus, cannot use a subquery if the SELECT list contains columns from more than one table.


Chapter 6 SQL: Data Definition
Review Questions


6.1 Discuss the functionality and importance of the Integrity Enhancement Feature (IEF).

Required data: NOT NULL of CREATE/ALTER TABLE.

Domain constraint: CHECK clause of CREATE/ALTER TABLE and CREATE

DOMAIN.

Entity integrity: PRIMARY KEY (and UNIQUE) clause of CREATE/ALTER

TABLE.

Referential integrity: FOREIGN KEY clause of CREATE/ALTER TABLE.

Enterprise constraints: CHECK and UNIQUE clauses of CREATE/ALTER TABLE and

(CREATE) ASSERTION.

See Section 6.2.

6.2 Discuss the advantages and disadvantages of views.

See Section 6.4.7.

6.3 Describe how the process of view resolution works.

Described in Section 6.4.3.

6.4 What restrictions are necessary to ensure that a view is updatable?

ISO standard specifies the views that must be updatable in a system that conforms to the standard. Definition given in SQL standard is that a view is updatable if and only if:

o DISTINCT is not specified; that is, duplicate rows must not be eliminated from the query results.
o Every element in the SELECT list of the defining query is a column name (rather than a constant, expression, or aggregate function) and no column appears more than once.
o The FROM clause specifies only one table; that is, the view must have a single source table for which the user has the required privileges. If the source table is itself a view, then that view must satisfy these conditions. This, therefore, excludes any views based on a join, union (UNION), intersection (INTERSECT), or difference (EXCEPT).
o The WHERE clause does not include any nested SELECTs that reference the table in the FROM clause.
o There is no GROUP BY or HAVING clause in the defining query.



In addition, every row that is added through the view must not violate the integrity constraints of the base table (Section 6.4.5).

6.5 What is a materialized view and what are the advantages of a maintaining a materialized view rather than using the view resolution process?

Materialized view is a temporary table that is stored in the database to represent a view, which is maintained as the base table(s) are updated.

Advantages – may be faster than trying to perform view resolution.

– may also be useful for integrity checking and query optimisation.

See Section 6.4.8.

6.6 Discuss how the Access Control mechanism of SQL works.

Each user has an authorization identifier (allocated by DBA).

Each object has an owner. Initially, only owner has access to an object but the owner can pass privileges to carry out certain actions on to other users via the GRANT statement and take away given privileges using REVOKE.


Chapter 7 Query-By-Example



Chapter 8 Commercial RDBMSs: Access and Oracle

Review Questions


8.1 Describe the objects that can be created within Microsoft Access.

See Section 8.1.1

8.2 Discuss how Access can be used in a multi-user environment.

See Section 8.1.2 (Multi-user support).

8.3 Describe the main data types in Access and when each type would be used.

See Table 8.1.

8.4 Describe two ways to create tables and relationships in Access.

See start of Section 8.1.3, which lists 5 ways.

8.5 Describe three ways to create enterprise constraints in Access.

See start of Section 8.1.5, which lists 3 ways.

8.6 Describe the objects that can be created within Oracle.

See Section 8.2.1.

8.7 Describe Oracle’s logical database structure.

Oracle’s logical structure consists of tablespaces, schemas, and data blocks and extents/segments (see Section 8.2.2).

8.8 Describe Oracle’s physical database structure.

Oracle’s physical structure consists of datafiles, redo log files, and control files (see Section 8.2.2).

8.9 Discuss the use of the two space management parameters PCTFREE and PCTUSED.

See Section 8.2.2.

8.10 Describe the main data types in Oracle and when each type would be used.

See Table 8.3.

8.11 Describe two ways to create tables and relationships in Oracle.

Using SQL*Plus or Create Table Wizard (see Section 8.2.3).

8.12 Compare and contrast three ways to create enterprise constraints in Oracle.

See Section 8.2.4, which lists 4 ways.

8.13 Describe the structure of a PL/SQL block.

See Section 8.2.5.



Chapter 9 Database Planning, Design, and Administration
Review Questions


9.1 Describe the major components of an information system.

Database, database software, application software, computer hardware including storage media, and personnel using and developing the system.

9.2 Discuss the relationship between the information systems lifecycle and the database application lifecycle.

See Sections 9.1 and 9.2.

9.3 Describe the main purpose(s) and activities associated with each stage of the database application lifecycle.

See Table 9.1 in Section 9.2.

9.4 Discuss what a user view represents in the context of a database application.

User view: defines what is required of a database application from the perspective of a particular job role (such as Manager or Supervisor) or enterprise application area (such as marketing, personnel, or stock control) (see Section 9.4.1).

9.5 Discuss the main approaches for managing the design of a database application that has multiple user views.

Three main approaches: centralized, view integration, and combination of both approaches (see Section 9.5).

9.6 Compare and contrast the three phases of database design.

Three phases are conceptual database design, logical database design, and physical database design.

Conceptual database design constructs a model of the information used in an enterprise, independent of all physical considerations. Logical database design is based on a specific data model, but independent of all other physical considerations. Physical database design constructs a description of the implementation of the database on secondary storage (see Section 9.6.3).

9.7 What are the main purposes of data modeling and identify the criteria for an optimal data model.

The two main purposes of data modeling are to assist in the understanding of the meaning (semantics) of the data and to facilitate communication about the information requirements (see Section 9.6.2).

9.8 Identify the stage(s) where it is appropriate to select a DBMS and describe an approach to selecting the ‘best’ DBMS.

Physical database design is tailored to a specific DBMS, therefore it is essential the DBMS is determined before the physical design phase can begin. The aims of physical database design are described in Section 9.6.3.

9.9 Application design involves transaction design and user interface design. Describe the purpose and main activities associated with each.

See Section 9.8.

9.10 Discuss why testing cannot show the absence of faults, only that software faults are present.

See Section 9.12.

9.11 Outline the various testing strategies available for testing that a database application appears to be working.

Various testing strategies, such as top-down, bottom-up, thread, stress.

9.12 Describe the main advantages of using the prototyping approach when building a database application.

Should be relatively inexpensive to develop and quick to build (see Section 9.9).

9.13 Define the purpose and tasks associated with data administration and database administration.

See Section 9.15.




Chapter 10 Fact-Finding Techniques

Review Questions


10.1 Briefly describe what the process of fact-finding attempts to achieve for a database developer.

Attempts to uncover facts about the business and the users of the database application including the vocabulary, problems, opportunities, constraints, requirements, and priorities.

10.2 Describe how fact-finding is used throughout the stages of the database application lifecycle.

See Table 10.1 in Section 10.2.

10.3 For each stage of the database application lifecycle identify examples of the facts captured and the documentation produced.

See Table 10.1 in Section 10.2.

10.4 A database developer normally uses several fact-finding techniques during a single database project. The five most commonly used techniques are examining documentation, interviewing, observing the business in operation, conducting research, and using questionnaires. Describe each fact-finding technique and identify the advantages and disadvantages of each.

See Section 10.3.

10.5 Describe the purpose of defining a mission statement and mission objectives for a database application.

Mission statement defines the major aims of the database application; the mission objectives identify the particular tasks that the database must support. Helps define the scope and boundary of the database application (see Section 10.4.2).

10.6 What is the purpose of identifying the systems boundary for a database application?

Ensures that all appropriate areas of the organization are included in the system (see Section 10.4.3).

10.7 How does the contents of a users’ requirements specification differ from a systems specification?

Systems specification describes the any features to be included in the new database application such as networking and shared access requirements, performance requirements, and the levels of security required. On the other hand, the users’ requirements specification describes in detail the data to be held in the database and how the data is to be used (see Section 10.4.4).

10.8 Describe one method to deciding whether to use either the centralized or view integration approach, or a combination of both when developing a database application for multiple user views.

One way is to examine the overlap in the data used between the various user views (see, for example, Table 10.7).


Chapter 11 Entity–Relationship Modeling
Review Questions


11.1 Describe what entity types represent in an ER model and provide examples of entities with a physical or conceptual existence.

An entity type represents a group of ‘objects’ in the real world with the same properties (see Section 11.1). Examples of entities with physical and conceptual existence shown in Figure 11.2.

11.2 Describe what relationship types represent in an ER model and provide examples of unary, binary, ternary, and quaternary relationships.

A relationship type is a set of associations between one or more participating entity types (see Section 11.2). Examples:

Unary: Staff Supervise Staff (also called recursive relationship)

Binary: Branch Has Staff

Ternary: Staff Registers Client at Branch

Quaternary: Solicitor Arranges Bid with a Buyer supported by a Financial Institution.

11.3 Describe what attributes represent in an ER model and provide examples of simple, composite, single-value, multi-value, and derived attributes.

An attribute represents a property of an entity or a relationship type (see Section 11.3). Examples:

Simple: position or salary attribute of Staff

Composite: address attribute composed of street, city, and postcode attributes

Single-valued: branchNo attribute of Branch

Multi-valued: telNo attribute of Branch

Derived: duration attribute of Lease, calculated from rentStart and rentFinish attributes.

11.4 Describe what the multiplicity constraint represents for a relationship type.

Multiplicity represents the number (or range) of possible occurrences of an entity type that may relate to a single occurrence of an associated entity type through a particular relationship (see Section 11.6).

11.5 What are enterprise constraints and how does multiplicity model these constraints?

Enterprise constraints are rules that the data in the database must conform to as specified by users or database administrators of a database (see Section 3.3.4).

Multiplicity constrains the way that entities are related – it is a representation of the policies (or business rules) established by the user or enterprise.

11.6 How does multiplicity represent both the cardinality and the participation constraints on a relationship type?

Multiplicity actually consists of two separate constraints (see Section 11.6.5):

Cardinality – which describes the maximum number of possible relationship occurrences for an entity participating in a given relationship type.

Participation – which determines whether all or only some entity occurrences participate in a relationship.

11.7 Provide an example of a relationship type with attributes.

The relationship Newspaper Advertises PropertyForRent consists of two attributes: dateAdvert (representing the date the advert took place) and cost (representing the cost of the advert).

11.8 Describe how strong and weak entity types differ and provide an example of each.

A strong entity type is an entity type that is not existence-dependent on some other entity type (see Section 11.4). Examples of strong entity types are Branch, Staff, and PropertyForRent.

A weak entity type is an entity type that is existence-dependent on some other entity type. An example of a weak entity type is Preference.

11.9 Describe how fan and chasm traps can occur in an ER model and how they can be resolved.

A fan trap occurs where a model represents a relationship between two entity types, but the pathway between certain entity occurrences is ambiguous. Resolve the fan trap by restructuring the original ER diagram to represent the correct association between these entities (see Section 11.7.1).

A chasm trap occurs where a model suggests the existence of a relationship between entity types, but the pathway does not exist between certain entity occurrences. A chasm trap may occur where there are one or more relationships with optional participation. Resolve the chasm trap by identifying the missing relationship (see Section 11.7.2).


Chapter 12 Enhanced Entity–Relationship Modeling
Review Questions

12.1 Describe what a superclass and a subclass represent.

A superclass is an entity type that includes one or more distinct subgroupings of its occurrences, which require to be represented in a data model. A subclass is a distinct subgrouping of occurrences of an entity type, which require to be represented in a data model (see Section 12.1.1).

12.2 Describe the relationship between a superclass and its subclass.

The relationship between superclass and subclass is 1:1, called a superclass/subclass relationship (see Section 12.1.2). Each member of a subclass is also a member of the superclass.

12.3 Describe and illustrate using an example the process of attribute inheritance.

An entity in a subclass represents the same ‘real world’ object as in the superclass, and may possess subclass-specific attributes, as well as those associated with the superclass. For example, a member of the SalesPersonnel subclass inherits all the attributes of the Staff superclass such as staffNo, name, position, and salary together with those specifically associated with the SalesPersonnel subclass such as salesArea and carAllowance (see Section 12.1.3).

12.4 What are the main reasons for introducing the concepts of superclasses and subclasses into an EER model?

There are two important reasons for introducing the concepts of superclasses and subclasses into an ER model. Firstly, it avoids describing similar concepts more than once, thereby saving time for the designer and making the ER diagram more readable. Secondly, it adds more semantic information to the design in a form that is familiar to many people. For example, the assertions that ‘Manager IS-A member of staff’ and ‘flat IS-A type of property’, communicates significant semantic content in a concise form (see Section 12.1.2).

12.5 Describe what a shared subclass represents and how does this concept relate to multiple inheritance.

A subclass with more than one superclass is called a shared subclass. The subclass will inherit the attributes of all its superclasses (i.e. multiple inheritance).

12.6 Describe and contrast the process of specialization with the process of generalization.

Specialization is the process of maximizing the differences between members of an entity by identifying their distinguishing features. Generalization is the process of minimizing the differences between entities by identifying their common features. Specialization is a top-down approach whereas generalization is a bottom-up approach (see Sections 12.1.4 and 12.1.5).

12.7 Describe the two main constraints that apply to a specialization/generalization relationship.

Two main constraints are: participation and disjoint constraints (see Section 12.1.6).

12.8 Describe and contrast the concepts of aggregation and composition and provide an example of each.

Aggregation represents a ‘has-a’ or ‘is-part-of’ relationship between entity types, where one represents the ‘whole’ and the other ‘the part’. Composition is a specific form of aggregation that represents an association between entities, where there is a strong ownership and coincidental lifetime between the ‘whole’ and the ‘part’ (see Sections 12.2 and 12.3).


Chapter 13 Normalization
Review Questions


13.1 Describe the purpose of normalizing data.

When we design a database for a relational system, the main objective in developing a logical data model is to create an accurate representation of the data, its relationships and constraints. To achieve this objective, we must identify a suitable set of relations. A technique that we can use to help identify such relations is called normalization. Normalization is a technique for producing a set of relations with desirable properties, given the data requirements of an enterprise. Normalization supports database designers by presenting a series of tests, which can be applied to individual relations so that a relational schema can be normalized to a specific form to prevent the possible occurrence of update anomalies.

See also Sections 13.1 and 13.4.

13.2 Describe the types of update anomalies that may occur on a relation that has redundant data.

A major aim of relational database design is to group attributes into relations so as to minimize information redundancy and thereby reduce the file storage space required by the base relations. Another serious difficulty using relations that have redundant information is the problem of update anomalies. These can be classified as insertion, deletion, or modification anomalies.

See Section 13.2.

13.3 Describe the concept of functional dependency.

Functional dependency describes the relationship between attributes in a relation. For example, if A and B are attributes of relation R, B is functionally dependent on A (denoted A → B), if each value of A in R is associated with exactly one value of B in R.

Functional dependency is a property of the meaning or semantics of the attributes in a relation. The semantics indicate how the attributes relate to one another and specify the functional dependencies between attributes. When a functional dependency is present, the dependency is specified as a constraint between the attributes.

See also Section 13.3.

13.4 How is the concept of functional dependency associated with the process of normalization?

Normalization is a formal technique for analysing relations based on their primary key (or candidate keys in the case of BCNF) and functional dependencies. Normalization is often performed as a series of tests on a relation to determine whether it satisfies or violates the requirements of a given normal form. Three normal forms were initially proposed, which are called first (1NF), second (2NF) and third (3NF) normal form. Subsequently, a stronger definition of third normal form was introduced and is referred to as Boyce–Codd normal form (BCNF). All of these normal forms are based on the functional dependencies among the attributes of a relation.

13.4 What are the main characteristics of functional dependencies that are used when normalizing a relation?

The main characteristics of functional dependencies that we use in normalization (see Section 13.3.1):

o have a one-to-one relationship between attribute(s) on the left and right-hand side of a dependency;
o hold for all time;
o are nontrivial.



13.5 Describe how a database designer typically identifies the set of functional dependencies associated with a relation.

Normally, the database designer starts by specifying functional dependencies that are semantically obvious; however, there are usually numerous other functional dependencies. In fact, the task of specifying all possible functional dependencies for ‘real’ database projects is more often than not, impractical. To begin to identify the set of functional dependencies F for a relation, typically first identify the dependencies that are determined from the semantics of the attributes of the relation. Then, apply Armstrong’s axioms (Rules 1 to 3) to infer additional functional dependencies that are also true for that relation. A systematic way to determine these additional functional dependencies is to first determine each set of attributes A that appears on the left-hand side of some functional dependencies and then to determine the set of all attributes that are dependent on A. Thus, for each set of attributes A we can determine the set A+ of attributes that are functionally determined by A based on F; (A+ is called the closure of A under F).

13.6 Describe Armstrong’s axioms.

Armstrong’s axioms specify how new functional dependencies can be inferred from given ones. Let A, B, and C be subsets of the attributes of the relation R. Armstrong’s axioms are as follows:

1. Reflexivity: If B is a subset of A, then A → B

2. Augmentation : If A → B, then A,C → Β,C

3. Transitivity: If A → B and B → C, then A → C

13.7 Describe the characteristics of a table in unnormalized form (UNF) and describe how such a table is converted to a first normal form (1NF) relation.

A table in unnormalized form contains one or more repeating groups. To convert to first normal form (1NF) either remove the repeating group to a new relation along with a copy of the original key attribute(s), or remove the repeating group by entering appropriate data in the empty columns of rows containing the repeating data (see Section 13.5).

13.8 What is the minimal normal form that a relation must satisfy? Provide a definition for this normal form.

Minimal normal form is 1NF: a relation in which the intersection of each row and column contains one and only one value (see Section 13.5).

13.9 Describe the two approaches to converting a first normal form (1NF) relation to second normal form (2NF) relation(s).

The normalization of 1NF relations to 2NF involves the removal of partial dependencies. If a partial dependency exists, we remove the functionally dependent attributes from the relation by placing them in a new relation along with a copy of their determinant (see Section 13.6.2).

13.10 Describe the concept of full functional dependency and describe how this concept relates to 2NF. Provide an example to illustrate your answer.

Full functional dependency Indicates that if A and B are attributes of a relation, B is fully functionally dependent on A if B is functionally dependent on A, but not on any proper subset of A.

Second Normal Form (2NF) is a relation that is in first normal form and every non-primary-key attribute is fully functionally dependent on the primary key.

13.11 Describe the concept of transitive dependency and describe how this concept relates to 3NF. Provide an example to illustrate your answer.

Transitive dependency A condition where A, B, and C are attributes of a relation such that if A → B and B → C, then C is transitively dependent on A via B (provided that A is not functionally dependent on B or C).

Third Normal Form (3NF) is a relation that is in first and second normal form in which no non-primary-key attribute is transitively dependent on the primary key.

13.12 Discuss how the definitions of 2NF and 3NF based on primary keys differ from the general definitions of 2NF and 3NF. Provide an example to illustrate your answer.

The above definitions for second (2NF) and third normal form (3NF) disallow partial or transitive dependencies on the primary key of relations to avoid update anomalies. However, these definitions do not take into account other candidate keys of a relation, if any exist. The more general definitions for 2NF and 3NF take account of the candidate keys of a relation. Note that this requirement does not alter the definition for 1NF as this normal form is independent of keys and functional dependencies. For the general definitions, we define that a primary-key attribute is part of any candidate key and that partial, full, and transitive dependencies are with respect to all candidate keys of a relation.

Second normal form (2NF) A relation that is in first normal form and every non-primary-key attribute is fully functionally dependent on any candidate key.

Third normal form (3NF) A relation that is in first and second normal form and in which no non-primary-key attribute is transitively dependent on any candidate key.

When using the general definitions of 2NF and 3NF we must be aware of partial and transitive dependencies on all candidate keys and not just the primary key. This can make the process of normalization more complex, however the general definitions place additional constraints on the relations and may identify hidden redundancy in relations that could be missed.

13.13 Discuss the purpose of Boyce–Codd Normal Form (BCNF) and describe how BCNF differs from 3NF. Provide an example to illustrate your answer.

BCNF is based on functional dependencies that take into account all candidate keys in a relation, however BCNF also has additional constraints compared with the general definition of 3NF given above.

Boyce–Codd normal form (BCNF) A relation is in BCNF if and only if every determinant is a candidate key.

To test whether a relation is in BCNF, we identify all the determinants and make sure that they are candidate keys.

See Sections 13.9 and 13.10.

13.14 Describe the concept of multi-valued dependency and describe how this concept relates to 4NF. Provide an example to illustrate your answer.

Multi-valued Dependency (MVD) Represents a dependency between attributes (for example, A, B, and C) in a relation, such that for each value of A there is a set of values for B and a set of values for C. However, the set of values for B and C are independent of each other.

A multi-valued dependency can be defined as being trivial or nontrivial. A MVD A ──ØØ B in relation R is defined as being trivial if (a) B is a subset of A or (b) A ∪ B = R. A MVD is defined as being nontrivial if neither (a) nor (b) are satisfied. A trivial MVD does not specify a constraint on a relation, while a nontrivial MVD does specify a constraint.

Fourth Normal Form (4NF) A relation that is in Boyce–Codd Normal Form and contains no nontrivial multi-valued dependencies.

Fourth normal form (4NF) is a stronger normal form than BCNF as it prevents relations from containing nontrivial MVDs, and hence data redundancy. The normalization of BCNF relations to 4NF involves the removal of the MVD from the relation by placing the attribute(s) in a new relation along with a copy of the determinant(s).

See Section 13.11.

13.15 Describe the concept of join dependency and describe how this concept relates to 5NF. Provide an example to illustrate your answer.

Lossless-join dependency A property of decomposition, which ensures that no spurious tuples are generated when relations are reunited through a natural join operation.

In splitting relations by projection, we are very explicit about the method of decomposition. In particular, we are careful to use projections that can be reversed by joining the resulting relations, so that the original relation is reconstructed. Such a decomposition is called a lossless-join (also called a nonloss or nonadditive) decomposition, because it preserves all the data in the original relation and does not result in the creation of additional spurious tuples. However, there are cases were we require to perform a lossless-join decompose of a relation into more than two relations. These cases are the focus of the lossless-join dependency and fifth normal form (5NF).

Fifth Normal Form (5NF) A relation that has no join dependency.

Fifth normal form (5NF) (also called project-join normal form (PJNF)) specifies that a 5NF relation has no join dependency.

See Section 13.12.
















Chapter 14 Methodology – Conceptual Database Design
Review Questions


14.1 Describe the purpose of a design methodology.

A structured approach that uses procedures, techniques, tools, and documentation aids, to support and facilitate the process of design. A design methodology consists of phases that contain steps, which guide the designer in the choice of techniques that are appropriate at each stage of the project and also helps to plan, manage, control and evaluate database development projects. Furthermore, it is a structured approach for analysing and modeling a set of requirements for a database in a standardized and organized manner.

See Section 14.1.

14.2 Describe the main phases involved database design.

Conceptual database design – to build the conceptual representation of the database, which includes identification of the important entities, relationships, and attributes.

Logical database design – to translate the conceptual representation to the logical structure of the database, which includes designing the relations.

Physical database design – to decide how the logical structure is to be physically implemented (as relations) in the target Database Management System (DBMS).

See Section 14.1.2 for complete definitions.

14.3 Identify important factors in the success of logical database design.

o Work interactively with the users as much as possible
o Follow a structured methodology throughout the data modeling process
o Employ a data-driven approach
o Incorporate structural and integrity considerations into the data models
o Combine conceptualization, normalization, and transaction validation techniques into the data modeling methodology
o Use diagrams to represent as much of the data models as possible
o Use a Database Design Language (DBDL) to represent additional data semantics that cannot easily be represented in a diagram
o Build a data dictionary to supplement the data model diagrams and the DBDL
o Be willing to repeat steps.



See Section 14.1.3.

14.4 Discuss the important role played by users in the process of database design.

The users’ involvement throughout the database design phase is critical to providing the ‘correct’ system. In particular, the user should clarify any ambiguities in the specification that describes the required system and also review continually the development of the database design. The process of developing the database design is repeated until the user is prepared to ‘sign-off’ the design as being a ‘true’ representation of the part of the enterprise that is being modeling.

See Sections 14.1.3 and 14.2 (Step 1.9).

14.5 Describe the main objective of conceptual database design.

See Section 14.3 Step 1.

14.6 Identify the main steps associated with conceptual database design.

See start of Section 14.3 Step 1.

14.7 How would you identify entity and relationship types from a user’s requirements specification?

One method of identifying entities is to examine the users’ requirements specification. From this specification, we identify nouns or noun phrases that are mentioned (for example, staff number, staff name, property number, property address, rent, number of rooms). We also look for major objects such as people, places, or concepts of interest, excluding those nouns that are merely qualities of other objects (see Step 1.1).

Having identified the entities, the next step is to identify all the relationships that exist between these entities. When we identify entities, one method is to look for nouns in the users’ requirements specification. Again, we can use the grammar of the requirements specification to identify relationships. Typically, relationships are indicated by verbs or verbal expressions (see Step 1.2).

14.8 How would you identify attributes from a user’s requirements specification and then associate the attributes with entity or relationship types?

In a similar way to identifying entities, we look for nouns or noun phrases in the users’ requirements specification. The attributes can be identified where the noun or noun phrase is a property, quality, identifier, or characteristic of one of these entities or relationships. By far the easiest thing to do when we have identified an entity (x) or a relationship (y) in the requirements specification is to consider What information are we required to hold on x or y? The answer to this question should be described in the specification. However, in some cases it may be necessary to ask the users to clarify the requirements. Unfortunately, they may give answers to this question that also contain other concepts, so that the users’ responses must be carefully considered.

As there are generally many more attributes than entities and relationships, it may be useful to first produce a list of all attributes given in the users’ requirements specification. As an attribute is associated with a particular entity or relationship, remove the attribute from the list. In this way, we ensure that an attribute is associated with only one entity or relationship type and, when the list is empty, that all attributes are associated with some entity or relationship type.

14.9 Describe the purpose of specialization/generalization of entity types, and discuss why this is an optional step in conceptual database design.

See Section 14.3 Step 1.6.

14.10 How would you check a data model for redundancy? Give an example to illustrate your answer.

(1) Re-examine one-to-one (1:1) relationships

In the identification of entities, we may have identified two entities that represent the same object in the enterprise. For example, we may have identified the two entities Client and Renter that are actually the same; in other words, Client is a synonym for Renter. In this case, the two entities should be merged together. If the primary keys are different, choose one of them to be the primary key and leave the other as an alternate key.

(2) Remove redundant relationships

A relationship is redundant if the same information can be obtained via other relationships. We are trying to develop a minimal data model and, as redundant relationships are unnecessary, they should be removed. It is relatively easy to identify whether there is more than one path between two entities. However, this does not necessarily imply that one of the relationships is redundant, as they may represent different associations between the entities.

See Section 14.3 Step 1.7.

14.11 Discuss why you would want to validate a conceptual data model and describe two approaches to validating a conceptual model.

We validate a conceptual data model to check the model to ensure that the model supports the transactions required by this view. Using the model, we attempt to perform the operations manually. If we can resolve all transactions in this way, we have checked that the conceptual data model supports the required transactions. However, if we are unable to perform a transaction manually there must be a problem with the data model, which must be resolved. In this case, it is likely that we have omitted an entity, a relationship, or an attribute from the data model.

Two possible approaches to ensuring that the local conceptual data model supports the required transactions are:

(1) describing the transactions;

(2) using transaction pathways.

See Section 14.3 Step 1.8.

14.12 Identify and describe the purpose of the documentation generated during conceptual database design.

See Section 14.3 and in particular note the documentation generated at the end of each step.


Chapter 15 Methodology – Logical Database Design for Relational Model
Review Questions


15.1 Discuss the purpose of logical database design.

For the purpose of logical database design see Section 15.1.

15.2 Describe the types of structures that are known not to be compatible with the relational model and describe how they could be removed from a conceptual data model. Give examples to illustrate your answer.

Remove: many-to-many (*:*) binary relationship types; many-to-many (*:*) recursive relationship types; complex relationship types; multi-valued attributes. Removal results in the creation of a new entity and corresponding relationships (see Step 2.1).

15.3 Describe the rules for deriving relations that represent:

1. strong entity types;
2. weak entity types;
3. one-to-many (1:*) binary relationship types;
4. one-to-one (1:1) binary relationship types;
5. one-to-one (1:1) recursive relationship types;
6. superclass/subclass relationship types;
7. many-to-many (*:*) binary relationship types;
8. complex relationship types;
9. multi-valued attributes.



See Table 15.2 below.



15.4 Discuss how the technique of normalization can be used to validate the logical data model and the relations derived from the model.

The logical data model can be validated using the technique of nomalization and against the transactions that the model is required to support. Normalization is used to improve the model so that it satisfies various constraints that avoid unnecessary duplication of data. Normal-
ization ensures that the resultant model is a closer model of the enterprise that it serves, it is consistent, and has minimal redundancy and maximum stability.

See also Section 15.1 Step 2.3.

15.5 Discuss two approaches that can be used to validate that the logical data model is capable of supporting the transactions required by the user’s view.

Two possible approaches to ensure that the logical data model supports the required transactions include: checking that all the information (entities, relationships and their attributes) required by each transaction is provided by the model in documenting a description of each transaction’s requirements, and diagrammatically representing the pathway taken by each transaction directly on the ER diagram.

See also Section 15.1 Step 2.4.

15.6 Describe the purpose of integrity constraints and identify the five main types of constraints.

The main types of constraints include: There are five types of integrity constraints: required data, attribute domain constraints, entity integrity, referential integrity, and enterprise constraints.

See also Section 15.1 Step 2.6.

15.7 Describe the alternative strategies that can be applied if there exists a child occurrence referencing a parent occurrence that we wish to delete.

There are several strategies to consider when there exists a child occurrence referencing the parent occurrence that we are attempting to delete: NO ACTION, CASCADE, SET NULL, SET DEFAULT, and NO CHECK.

See also Section 15.1 Step 2.6.


15.8 Identify the tasks typically associated with merging local logical data models into a global logical model.

See Section 15.1 Step 3 and in particular Step 3.1.


Chapter 16 Methodology – Physical Database Design for Relational Databases
Review Questions


16.1 Explain the difference between conceptual, logical, and physical database design. Why might these tasks be carried out by different people?

Conceptual database design is concerned with building the data model for the organization that is completely independent of any physical considerations including DBMS (logical database design assumes a particular DBMS, for example, relational, but is independent of any other physical considerations). Physical database design, however, is concerned with actually defining the data model using the DDL of a particular DBMS. Consequently, conceptual/logical database design focuses on what the data model represents, whereas physical database design focuses on how the data model is to be implemented. Different skills are required to undertake these design phases, which are often found in different people. See Section 16.1.

16.2 Describe the inputs and outputs of physical database design.

The inputs are the global logical data model and the data dictionary. The outputs are the base relations, integrity rules, file organization specified, secondary indexes determined, user views and access rules. See Section 16.3.

16.3 Describe the purpose of the main steps in the physical design methodology presented in this chapter.

Step 4 Produces a relational database schema from the global logical data model. This includes integrity rules.

Step 5 Determines the file organizations for the base relations. This takes account of the nature of the transactions to be carried out, which also determine where secondary indexes will be of use.

Step 6 Designs the user views for the database implementation.

Step 7 Designs the security mechanisms for the database implementation. This includes designing the access rules on the base relations.

Step 8 Considers relaxing the normalization constraints imposed on the logical data model to improve the overall performance of the system.

Step 9 Monitors the database application systems and improves performance by making amendments to the design as appropriate.

See also Section 16.2.

16.4 ‘One of the main objectives of physical database design is to store data in an efficient way.’ How might we measure efficiency in this context?

This can be measured by the number of transactions that can be processed by the system in a given time frame, or by the length of time it takes to complete one transaction, or by the amount of disk storage taken up by the database files. See also Section 16.3 Step 5.

Chapter 17 Methodology – Monitoring and Tuning the Operational System
Review Questions


17.1 Describe the purpose of the main steps in the physical design methodology presented in this chapter.

Step 8 of physical database design considers denormalizing the relational schema to improve performance. There may be circumstances where it may be necessary to accept the loss of some of the benefits of a fully normalized design in favor of performance. This should be considered only when it is estimated that the system will not be able to meet its performance requirements. As a rule of thumb, if performance is unsatisfactory and a relation has a low update rate and a very high query rate, denormalization may be a viable option.

The final step (Step 9) of physical database design is the ongoing process of monitoring and tuning the operational system to achieve maximum performance.

17.2 Under what circumstances would you want to denormalize a logical data model? Use examples to illustrate your answer.

Generally, if overall performance needs to be improved, controlled redundancy can be introduced (see also Step 8).

Examples:

If queries on staff always required the branch address, this attribute could be posted into staff. The effect on updating would be minimal if branch data was relatively static, and it removes a join from the query.

If the number of staff for each branch was often required with branch details, a derived attribute could be placed in branch. This would remove the need to access and repeatedly count the relevant records in staff. When staff joined or left a branch, this attribute would required updating.


Chapter 18 Security
Review Questions


18.1 Explain the purpose and scope of database security.

The purpose is clearly concerned with the protection of the data. However, the scope is wider than that of the DBMS alone, and takes into account the database environment. Consequently, it also considers the hardware, software, and users.

See also Section 18.1.

18.2 List the main types of threat that could affect a database system, and for each describe the controls that you would use to counteract each of them.

For threats see Section 18.1.1 and for computer-based countermeasures see Section 18.2.

18.3 Explain the following in terms of providing security for a database:

(a) authorization See Section 18.2.1

(b) views See Section 18.2.2

(c) backup and recovery See Section 18.2.3

(d) integrity See Section 18.2.4 and Section 3.3

(e) encryption See Section 18.2.5

(f) RAID technology See Section 18.2.6

18.4 Describe the security measures provided by Microsoft Access or Oracle DBMS.

For Access, this may involve setting a password (system security) or user-level security (data security), as described in Section 18.3.

For Oracle, again can use username and password mechanism (system security). Oracle also supports privileges (both at the system level and at the object level) and supports roles. These mechanisms are described in Section 18.4.

18.5 Describe the approaches for securing DBMSs on the Web.

The approaches for securing DBMSs on the Web are discussed in Section 18.5 and include proxy servers, firewalls, message digest algorithms and digital signatures, digital certificates, Kerberos, SSL and SHHTP, SET and STT.


Chapter 19 Transaction Management
Review Questions


19.1 Explain what is meant by a transaction. Why are transactions important units of operation in a DBMS?

Transaction: An action, or series of actions, carried out by a single user or application program, which reads or updates the contents of the database (Section 19.1).

A logical unit of work that transforms the database from one consistent state to another. Also the unit of concurrency and recovery control.

19.2 The consistency and reliability aspects of transactions are due to the ‘ACIDity’ properties of transactions. Discuss each of these properties and how they relate to the concurrency control and recovery mechanisms. Give examples to illustrate your answer.

Atomicity The ‘all or nothing’ property. It is the responsibility of the recovery subsystem of the DBMS to ensure atomicity.

Consistency A transaction must transform the database from one consistent state to another consistent state. It is the responsibility of both the DBMS and the application developers to ensure consistency.

Isolation Transactions execute independently of one another. In other words, the partial effects of incomplete transactions should not be visible to other transactions. It is the responsibility of the concurrency control subsystem to ensure isolation.

Durability The effects of a successfully completed (committed) transaction are permanently recorded in the database and must not be lost because of a subsequent failure. It is the responsibility of the recovery subsystem to ensure durability.

ACID properties discussed in Section 19.1.1.

19.3 Describe, with examples, the types of problem that can occur in a multi-user environment when concurrent access to the database is allowed.

Lost update problem, the uncommitted dependency problem and the inconsistent analysis problem (see Examples 19.1 – 19.3).

19.4 Give full details of a mechanism for concurrency control that can be used to ensure the types of problems discussed in Question 19.3 cannot occur. Show how the mechanism prevents the problems illustrated from occurring. Discuss how the concurrency control mechanism interacts with the transaction mechanism.

Should discuss 2PL, timestamping, or an optimistic technique. Solutions to above problems for 2PL given in Examples 19.6 – 19.8.

Transaction is the unit of concurrency control.

19.5 Explain the concepts of serial, non-serial, and serializable schedules. State the rules for equivalence of schedules.

Schedule A sequence of the operations by a set of concurrent transactions that preserves the order of the operations in each of the individual transactions.

Serial schedule A schedule where the operations of each transaction are executed consecut-
ively without any interleaved operations from other transactions.

Nonserial schedule A schedule where the operations from a set of concurrent transactions are interleaved.

See Section 19.2.2.

19.6 Discuss the difference between conflict serializability and view serializability.

A schedule is conflict serializable if it is (conflict) equivalent to some serial schedule (it any conflicting operations are ordered in the same way as some serial schedule).

A schedule is view serializable if it is view equivalent to some serial schedule.

For more complete definitions see Section 19.2.2.

19.7 Discuss the types of problems that can occur with locking-based mechanisms for concurrency control and the actions that can be taken by a DBMS to prevent them.

Livelock and deadlock (see Section 19.2.3 and Section 19.2.4).

19.8 Why would two-phase locking not be an appropriate concurrency control scheme for indexes? Discuss a more appropriate locking scheme for tree-based indexes.

Concurrency control for an index structure can be managed by treating each page of the index as a data item and applying the 2PL protocol. However, since indexes are likely to be frequently accessed, particularly the higher levels of trees (as searching occurs from the root downwards), this simple concurrency control strategy may lead to high lock contention. Therefore, a more efficient locking protocol is required for indexes.

Can use the following locking strategy:

(1) For searches, obtain shared locks on nodes starting at the root and proceeding downwards along the required path. Release the lock on a node once a lock has been obtained on the child node.

(2) For insertions, a conservative approach would be to obtain exclusive locks on all nodes as we descend the tree to the leaf node to be modified. This ensures that a split in the leaf node can propagate all the way up the tree to the root. However, if a child node is not full the lock on the parent node can be released. A more optimistic approach would be to obtain shared locks on all nodes as we descend to the leaf node to be modified, where we obtain an exclusive lock on the leaf node itself. If the leaf node has to split, we upgrade the shared lock on the parent node to an exclusive lock. If this node also has to split, we continue to upgrade the locks at the next higher level. In the majority of cases, a split is not required making this a better approach.

See end of Section 19.2.3.

19.9 What is a timestamp? How do timestamp-based protocols for concurrency control differ from locking based protocols?

Timestamp A unique identifier created by the DBMS that indicates the relative starting time of a transaction.

The use of locks, combined with the 2PL protocol, guarantees serializability of schedules. The order of transactions in the equivalent serial schedule is based on the order in which the transactions lock the items they require. If a transaction needs an item that is already locked, it may be forced to wait until the item is released.

Timestamp methods for concurrency control are quite different; no locks are involved, and therefore there can be no deadlock. Locking methods generally prevent conflicts by making transactions wait. With timestamp methods, there is no waiting; transactions involved in conflict are simply rolled back and restarted.

See Section 19.2.5.

19.10 Describe the basic timestamp ordering protocol for concurrency control. What is Thomas’s write rule and how does this affect the basic timestamp ordering protocol?

Basic timestamp ordering described in Section 19.2.5.

Thomas’s write rule provides greater concurrency by rejecting obsolete write operations (i.e. Transaction T asks to write an item whose value has already been written by a younger transaction).

19.11 Describe how versions can be used to increase concurrency.

Multiversion timestamp ordering described in Section 19.2.6. In effect, each write operation creates a new version of a data item while retaining the old version. When a transaction attempts to read a data item, the DBMS selects one of the versions that ensures serializability.

19.12 Discuss the difference between pessimistic and optimistic concurrency control?

Pessimistic concurrency control protocols delay operations to ensure that conflict does not occur. On the other hand, optimistic concurrency control protocols assume that conflicts are rare and allow transactions to proceed without imposing any delays (instead checking that serializability has not been broken at commit time).

See Section 19.2.7.

19.13 Discuss the types of failure that may occur in a database environment. Explain why it is important for a multi-user DBMS to provide a recovery mechanism.

Failures given in Section 19.3.1. Answer to second part is based on the amount of work that potentially could be lost following a failure.

19.14 Discuss how the log file (or journal) is a fundamental feature in any recovery mechanism. Explain what is meant by forward and backward recovery and describe how the log file is used in forward and backward recovery. What is the significance of the write-ahead log protocol? How do checkpoints affect the recovery protocol?

Log file contains before and after-images of updates to the database. Before images can be used to undo changes to the database (i.e. perform backward recovery); after-images can be used to redo changes (i.e. perform forward recovery).

Write-ahead log protocol ensures that log records are written before the corresponding write to the database. Thus, if the system fails before the write occurs after the log record has been written but before the write to the database, the system can recover using the information in the log file.

Log file also contains a checkpoint record, which can speed up the time for recovery following a failure.

19.15 Compare and contrast the deferred update and immediate update recovery protocols.

Two protocols are discussed in Section 19.3.4.

19.16 Discuss the following advanced transaction models:

1. nested transactions,
2. sagas,
3. multi-level transactions,
4. dynamically restructuring transactions.



See Section 19.4.


Chapter 20 Query Processing
Review Questions


20.1 What are the objectives of query processing?

The aims of query processing are to transform a query written in a high-level language, typically SQL, into a correct and efficient execution strategy expressed in a low-level language (implementing relational algebra), and to execute the strategy to retrieve the required data (see Section 20.1).

20.2 How does query processing in relational systems differ from the processing of low-level query languages for network and hierarchical systems?

In first generation network and hierarchical database systems, the low-level procedural query language is generally embedded in a high-level programming language such as COBOL, and it is the programmer’s responsibility to select the most appropriate execution strategy. In contrast, with declarative languages such as SQL, the user specifies what data is required rather than how it is to be retrieved. This relieves the user of the responsibility of determining, or even knowing, what constitutes a good execution strategy and makes the language more universally usable (see start of chapter).

20.4 What are the typical phases of query decomposition?

The typical phases of query decomposition are analysis, normalization, semantic analysis, simplification, and query restructuring (see Section 20.2).

20.5 What is the difference between conjunctive and disjunctive normal form?

Conjunctive normal form: A sequence of conjuncts that are connected with the ∧ (AND) operator. Each conjunct contains one or more terms connected by the ∨ (OR) operator. A conjunctive selection contains only those tuples that satisfy all conjuncts.

Disjunctive normal form: A sequence of disjuncts that are connected with the ∨ (OR) operator. Each disjunct contains one or more terms connected by the ∧ (AND) operator. A disjunctive selection contains those tuples formed by the union of all tuples that satisfy the disjuncts.

See Section 20.2 under normalization.

20.6 How would you check the semantic correctness of a query?

See Section 20.3 under semantic analysis.

20.7 State the transformation rules that apply to:

1. Selection operations. See Section 20.3.1: Rules 1, 2, 4, 6, 9.
2. Projection operations. See Section 20.3.1: Rules 3, 4, 7, 10.
3. Theta-join operations. See Section 20.3.1: Rules 5, 6, 7, 11.



20.8 State the heuristics that we should apply to improve the processing of a query.

See Section 20.3.2.

20.9 What type of statistics should a DBMS hold to be able to derive estimates of relational algebra operations?

See Section 20.4.1.

20.10 Under what circumstances would the system have to resort to a linear search when implementing a selection operation?

1. Unordered file, with no indexes.
2. Composite predicate where one of the terms contains an OR condition and the term requires a linear search.
3. Composite predicate where no attribute can be used for efficient retrieval.



20.11 What are the main strategies for implementing the Join operation?

Main strategies for implementing Join are: block nested loop join, indexed nested loop join, sort-merge join, hash join. See Section 20.4.3.

20.12 What is the difference between materialization and pipelining?

Materialization – output of one operation is stored in a temporary relation for processing by next operation.

Pipelining – pipeline results of one operation to another operation without creating a temporary relation to hold the intermediate result.

See Section 20.5.

20.13 Discuss the difference between linear and non-linear relational algebra trees. Give examples to illustrate your answer.

Linear tree – relation on one side of each operator is always a base relation. See Section 20.5 under Linear Trees.

20.14 What are the advantages and disadvantages of left-deep trees?

The inner relation of a join needs to be examined for each tuple of the outer relation, so inner relations must always be materialized. With a left-deep tree, the inner relation is always a base relation, and so already materialized.

Chapter 21 Programmatic SQL
Review Questions


21.1 Discuss the difference between interactive SQL, static embedded SQL, and dynamic embedded SQL.

Interactive SQL: SQL statements usually input interactively from a terminal.

Static and dynamic embedded SQL refers to the embedding of SQL statements in a high-level programming language such as C. Embedded SQL statements are changed by a preprocessor provided with the DBMS vendor into functions calls.

The basic difference between static and dynamic embedded SQL is that static SQL does not allow host variables to be used in place of table names or column names.

21.2 Describe what host language variables are and give an example of their use.

A host language variable is a program variable declared in the host language. It can be either a single variable or a structure. Host language variables can be used in embedded SQL statements to transfer data from the database into the program, and vice versa. They can also be used within the WHERE clause of SELECT statements. In fact, they can be used anywhere that a constant can appear. However, they cannot be used to represent database objects, such as table names or column names.

See Section 21.1.3.

21.3 Describe what indicator variables are and give an example of their use.

Most programming languages do not provide support for unknown or missing values, as represented in the relational model by nulls. This causes a problem when a null has to be inserted or retrieved from a table. Embedded SQL provides indicator variables to resolve this problem. Each host variable has an associated indicator variable that can be set or examined.

See Section 21.1.3.

21.4 Describe what placeholders are and give an example of their use.

A placeholder is a dummy host variable that can appear anywhere in the hostVariable/
stringLiteral of the PREPARE statement where a constant can appear. A placeholder does not need to be declared and can be given any name. It signals to the DBMS that a value will be supplied later, in the EXECUTE statement. The program can supply different parameter values each time the dynamic statement is executed.

See Section 21.2.2.

21.5 Describe the functions of the SQLCA and SQLDA.

The DBMS uses an SQL Communications Area (SQLCA) to report runtime errors to the application program. The SQLCA is a data structure that contains error variables and status indicators. An application program can examine the SQLCA to determine the success or failure of each SQL statement. See Section 21.1.2.

Placeholders are one way to pass parameters to the EXECUTE statement. An alternative is through a dynamic data structure called the SQL Descriptor Area (SQLDA). The SQLDA is used when the number of placeholders and their data types are not known when the statement is formulated. See Section 21.2.3.



Chapter 22 Distributed DBMSs – Concepts and Design
Review Questions


22.1 Explain what is meant by a DDBMS and discuss the motivation in providing such a system.

See Section 22.1.1; motivation given at start of Section 22.1.

22.2 Compare and contrast a DDBMS with distributed processing. Under what circumstances would you choose a DDBMS over distributed processing?

Distributed processing defined at end of Section 22.1.1. Would choose a DDBMS, for example, if each site needed control over its own data, sites had their own existing DBMSs, communication costs would be significantly reduced, and so on.

22.3 Compare and contrast a DDBMS with a parallel DBMS. Under what circumstances would you choose a DDBMS over a parallel DBMS?

Parallel DBMS defined at end of Section 22.1.1. Parallel DBMSs tend to be used over short distances, usually within the same site. If requirements need distribution over sites with large geographic spread, then choice should be straightforward.

22.4 Discuss the advantages and disadvantages of a DDBMS.

Your browser may not support display of this image.

See Section 22.1.2.

22.5 What is the difference between a homogeneous and heterogeneous DDBMS? Under what circumstances would such systems generally arise?

In a homogeneous system, all sites use the same DBMS product. In a heterogeneous system, sites may run different DBMS products, which need not be based on the same underlying data model, and so the system may be composed of relational, network, hierarchical, and object-oriented DBMSs.

Homogeneous systems are much easier to design and manage. This approach provides incremental growth, making the addition of a new site to the DDBMS easy, and allows increased performance by exploiting the parallel processing capability of multiple sites. Heterogeneous systems usually result when individual sites have implemented their own databases and integration is considered at a later stage.

See Section 22.1.3.

22.6 What is the main differences between LAN and WAN?

A local area network (LAN) is intended for connecting computers at the same site. A wide area network (WAN) is used when computers or LANs need to be connected over long distances. With the large geographical separation, the communication links in a WAN are relatively slow and less reliable than LANs. The transmission rates for a WAN generally range from 9.6 kilobits per second (dial-up via modem) to 45 megabits per second (T3 unswitched private line). Transmission rates for LANs are much higher, operating at 10 megabits per second (shared Ethernet) to 2500 megabits per second (ATM), and are highly reliable. Clearly, a DDBMS using a LAN for communication will provide a much faster response time than one using a WAN.

See Section 22.2.

22.7 What functionality do you expect in a distributed DBMS?

We expect a DDBMS to have at least the functionality for a centralized DBMS that we discussed in Chapter 2. In addition, we expect a DDBMS to have the following functionality:

o extended communication services to provide access to remote sites and allow the transfer of queries and data among the sites using a network;
o extended system catalog to store data distribution details;
o distributed query processing, including query optimization and remote data access;
o extended security control to maintain appropriate authorization/access privileges to the distributed data;
o extended concurrency control to maintain consistency of replicated data;
o extended recovery services to take account of failures of individual sites and the failures of communication links.



See Section 22.3.1.

22.8 What is a multidatabase system? Describe a reference architecture for such a system.

Multidatabase system (MDBS): a distributed DBMS in which each site maintains complete autonomy. (See Section 22.1.3.)

Reference architecture for a federated MDBS is given in Figure 22.5.

22.9 One problem area with DDBMSs is that of distributed database design. Discuss the issues that have to be addressed with distributed database design. Discuss how these issues apply to the global system catalog.

The question that is being addressed is how the database and the applications that run against it should be placed across the sites. Two basic alternatives: partitioned or replicated. In partitioned scheme database is divided into a number of disjoint partitions each of which is placed at a different site. Replicated designs can be fully or partially replicated.

Two fundamental design issues are fragmentation and distribution. Mostly involves mathematical programming to minimize combined cost of storing the database, processing transactions against it, and communication. Problem is NP-hard; therefore proposed solutions are based on heuristics.

The global system catalog (GSC) is only relevant if we talk about a distributed DBMS or multi-DBMS that uses a global conceptual schema. Problems are similar to above. Briefly, a GSC may be either global to entire database or local; it may be maintained centrally at one site, or in a distributed fashion over a number of sites; finally, replication – there may be a single copy of the directory or multiple copies. These three dimensions are orthogonal to one another.

22.10 What are the strategic objectives for the definition and allocation of fragments?

The definition and allocation of fragments are carried out strategically to achieve the following objectives:

o Locality of reference Where possible, data should be stored close to where it is used. If a fragment is used at several sites, it may be advantageous to store copies of the fragment at these sites.
o Improved reliability and availability Reliability and availability are improved by replication: there is another copy of the fragment available at another site in the event of one site failing.
o Acceptable performance Bad allocation may result in bottlenecks occurring: that is, a site may become inundated with requests from other sites, perhaps causing a significant degradation in performance. Alternatively, bad allocation may result in under-utilization of resources.
o Balanced storage capacities and costs Consideration should be given to the availability and cost of storage at each site, so that cheap mass storage can be used, where possible. This must be balanced against locality of reference.
o Minimal communication costs Consideration should be given to the cost of remote requests. Retrieval costs are minimized when locality of reference is maximized or when each site has its own copy of the data. However, when replicated data is updated, the update has to be performed at all sites holding a duplicate copy, thereby increasing communication costs.



See start of Section 22.4.

22.11 Describe alternative schemes for fragmenting a global relation. State how you would check for correctness to ensure that the database does not undergo semantic change during fragmentation.

Alternative schemes are: primary horizontal, vertical, mixed, and derived horizontal fragment-
ation (see Section 22.4.2).

Correctness rules are: completeness, reconstruction, and disjointness (see Section 22.4.2 again).

22.12 What layers of transparency should be provided with a DDBMS? Give examples toillustrate your answer. Justify your answer.

Main types of transparency in a DDBMS are as follows:

* Distribution transparency. If a DDBMS exhibits distribution transparency, then the user does not need to know the data is fragmented (fragmentation transparency) or the location of data items (location transparency). If the user needs to know that the data is fragmented and the location of fragments then we call this local mapping transparency. Closely related to location transparency is replication transparency, which means that the user is unaware of the replication of fragments. Replication transparency is implied by location transparency. However, it is possible for a system not to have location trans-
parency but to have replication transparency.
* Transaction transparency (consisting of concurrency transparency and failure transparency.
* Performance transparency.
* DBMS transparency.



See Section 22.5.

22.13 A DDBMS must ensure that no two sites create a database object with the same name. One solution to this problem is to create a central name server. What are the disadvantages with this approach? Propose an alternative approach that overcomes these disadvantages.

See Section 22.5.1 – Naming Transparency.

Problems with the central name server, which has the responsibility for ensuring uniqueness of all names in the system, are:

o loss of some local autonomy
o performance problems, if the central site becomes a bottleneck
o low availability, if the central site fails, the remaining sites cannot create any new database objects.



An alternative solution is to prefix an object with the identifier of the site that created it. For example, a relation BRANCH created at site S1 might be named S1.BRANCH. Similarly, we would need to be able to identify each fragment and each of its copies. Thus, copy 2 of fragment 3 of the branch relation created at site S1 might be referred to as S1.BRANCH.F3.C2. However, this results in loss of distribution transparency.

An approach that resolves the problems with both these solutions uses aliases for each database object. Thus, S1.BRANCH.F3.C2 might be known as local_branch by the user at site S1. The DDBMS has the task of mapping aliases to the appropriate database object.

22.14 What are the four levels of transactions defined in IBM’s DRDA? Compare and contrast these four levels. Give examples to illustrate your answer.

In DRDA, there are four types of transaction, each with a progressive level of complexity in the interaction between the DBMSs:

(1) remote request;

(2) remote unit of work;

(3) distributed unit of work;

(4) distributed request.

In this context, a ‘request’ is equivalent to an SQL statement and a ‘unit of work’ is a transaction.

See Section 22.5.2.


Chapter 23 Distributed DBMSs – Advanced Concepts
Review Questions


23.1 In a distributed environment, locking-based algorithms can be classified as centralized, primary copy, or distributed. Compare and contrast these algorithms.

See Section 23.2.3.

23.2 One of the most well-known methods for distributed deadlock detection was developed by Obermarck. Explain how Obermarck’s method works and how deadlock is detected and resolved.

See Section 23.3 under Distributed Deadlock Detection.

23.3 Outline two alternative two-phase commit topologies to the centralized topology.

Alternative topologies: linear and distributed 2PC. See end of Section 23.4.3.

23.4 Explain the term non-blocking protocol and explain why two-phase commit protocol is not a non-blocking protocol.

A non-blocking protocol should cater for both site and communication failures to ensure that the failure of one site will not affect processing at another site. In other words, operational sites should not be left blocked.

In the event that a participant has voted COMMIT but has not received global decision and is unable to communicate with any other site that knows the decision, that site is blocked. Although 2PC has a cooperative termination protocol that reduces the likelihood of blocking, blocking is still possible and the blocked process will just have to keep on trying to unblock as failures are repaired.

23.5 Discuss how the three-phase commit protocol is a non-blocking protocol in the absence of complete site failure.

The basic idea of 3PC is to remove the uncertainty period for participants who have voted commit and are waiting for the global abort or global commit from the coordinator. 3PC introduces a third phase, called pre-commit, between voting and global decision.

See Section 23.4.4.

23.6 Compare and contrast the different ownership models for replication. Give examples to illustrate your answer.

The main types of ownership are master/slave, workflow, and update-anywhere, sometimes referred to as peer-to-peer or symmetric replication. See Section 23.6.1.

23.7 Compare and contrast the database mechanisms for replication.

Discuss table snapshots versus database triggers – see Section 23.6.2.

23.8 Describe the additional functionality for mobile DBMSs.

The additional functionality required of mobile DBMSs includes the ability to:

o communicate with the centralized database server through modes such as wireless or Internet access;
o replicate data on the centralized database server and mobile device;
o synchronize data on the centralized database server and mobile device;
o capture data from various sources such as the Internet;
o manage data on the mobile device;
o analyse data on a mobile device;
o create customized mobile applications.



See Section 23.8.1.


Chapter 24 Introduction to Object DBMSs
Review Questions


24.1 Discuss the general characteristics of advanced database applications.

Designs of this type have some common characteristics:

o Design data is characterized by a large number of types, each with a small number of instances. Conventional databases are typically the opposite.
o Designs may be very large, perhaps consisting of millions of parts, often with many interdependent subsystem designs.
o The design is not static but evolves through time. When a design change occurs, its implications must be propagated through all design representations. The dynamic nature of design may mean that some actions cannot be foreseen at the beginning.
o Updates are far-reaching because of topological or functional relationships, tolerances, and so on. One change is likely to affect a large number of design objects.
o Often, many design alternatives are being considered for each component, and the correct version for each part must be maintained. This involves some form of version control and configuration management.
o There may be hundreds of staff involved with the design, and they may work in parallel on multiple versions of a large design. Even so, the end product must be consistent and coordinated. This is sometimes referred to as cooperative engineering.



See Section 24.1.

24.2 Discuss why the weaknesses of the relational data model and relational DBMSs may make them unsuitable for advanced database applications.

Waeknesses discussed in Section 24.2.

24.3 Discuss each of the following concepts in the context of an object data model:

(a) abstraction, encapsulation, and information hiding; See Section 24.3.1

(b) objects and attributes; See Section 24.3.2

(b) object identity; See Section 24.3.3

(c) methods and messages; See Section 24.3.4

(d) classes, subclasses, superclasses, and inheritance; See Section 24.3.5/6

(e) overriding ad overloading; See Section 24.3.7

(f) polymorphism and dynamic binding. See Section 24.3.8

Give examples using the DreamHome sample data shown in Figure 3.3. Expect examples similar to the ones in the above referenced sections.

24.4 Discuss the difficulties involved in mapping objects created in an object-oriented programming language to a relational database.

Difficulties include having to map a structure that is inherently hierarchical to something that is inherently flat. Section 24.4 provides an example of mapping a simple superclass structure to relational tables, and shows how semantic information is lost in the process. Further after the mapping, generally the original hierarchical structure has to be recreated, which requires additional software to be written and is inherently slow.

24.5 Describe the three generations of DBMSs.

Three generations are: hierarchical/network, relational, and now object DBMSs. See Section 24.5.



Chapter 25 Object-Oriented DBMSs – Concepts and Design
Review Questions


25.1 Compare and contrast the different definitions of object-oriented data models.

Discussion of definitions provided in Section 25.1.

25.2 What is a persistent programming language and how does it differ from an OODBMS?

A language that provides its users with the ability to (transparently) preserve data across successive executions of a program, and even allows such data to be used by different programs (see Section 25.1.1). The main difference between PPL and OODBMS is that the OODBMS tends to provide more DBMS-related services.

25.3 Discuss the difference between the two-level storage model used by conventional DBMSs and the single-level storage model used by OODBMSs.

See Section 25.2.

25.4 How does this single-level storage model affect data access?

See Section 25.2.2.

25.5 Discuss the main strategies that can be used to create persistent objects.

Checkpointing, serialization, and explicit paging. Explicit paging includes reachability-based and allocation-based persistence (see Section 25.3.1).

25.6 What is pointer swizzling? Discuss the different approaches to pointer swizzling.

Action of converting OIDs to main memory pointers and vice versa (see Section 25.2.1).

25.7 Discuss the types of transaction protocol that can be useful in design applications.

See Sections 25.4.1 and 19.4.

25.8 Discuss why version management may be a useful facility for some applications.

There are many applications that need access to the previous state of an object. For example, the development of a particular design is often an experimental and incremental process, the scope of which changes with time. It is therefore necessary in databases that store designs to keep track of the evolution of design objects and the changes made to a design by various transactions.

25.9 Discuss why schema control may be a useful facility for some applications.

Engineering design is an incremental process and evolves with time. To support this process, applications require considerable flexibility in dynamically defining and modifying the database schema. For example, it should be possible to modify class definitions, the inheritance structure, and specifications of attributes and methods without requiring system shutdown.

25.10 Compare and contrast the different architectures for an OODBMS.

See Section 25.4.4.

25.11 Describe how relationships can be modeled in an OODBMS.

Modeling of relationships discussed in Section 25.7.2.

25.12 List the advantages and disadvantages of an OODBMS.

Your browser may not support display of this image.Your browser may not support display of this image.

Advantages and disadvantages discussed in Section 25.6.




Chapter 26 Object-Oriented DBMSs: Standards and Systems
Review Questions


26.1 Discuss the main concepts of the ODMG Object Model. Give an example to illustrate each of the concepts.

The ODMG OM is a superset of the OMG OM, which enables both designs and implementations to be ported between compliant systems. It specifies the following basic modeling primitives:

o The basic modeling primitives are the object and the literal. Only an object has a unique identifier.
o Objects and literals can be categorized into types. All objects and literals of a given type exhibit common behavior and state. A type is itself an object. An object is sometimes referred to as an instance of its type.
o Behavior is defined by a set of operations that can be performed on or by the object. Operations may have a list of typed input/output parameters and may return a typed result.
o State is defined by the values an object carries for a set of properties. A property may be either an attribute of the object or a relationship between the object and one or more other objects. Typically, the values of an object’s properties can change over time.
o An ODMS stores objects, enabling them to be shared by multiple users and applications. An ODMS is based on a schema that is defined in the Object Definition Language (ODL), and contains instances of the types defined by its schema.



See Section 26.2.2.

26.2 What is the function of the ODMG Object Definition Language?

The Object Definition Language (ODL) is a language for defining the specifications of object types for ODMG-compliant systems, equivalent to the Data Definition Language (DDL) of traditional DBMSs. Its main objective is to facilitate portability of schemas between compliant systems while helping to provide interoperability between ODMSs. The ODL defines the attributes and relationships of types and specifies the signature of the operations, but it does not address the implementation of signatures. The syntax of ODL extends the Interface Definition Language (IDL) of the CORBA. The ODMG hope that the ODL will be the basis for integrating schemas from multiple sources and applications.

See Section 26.2.3.

26.3 What is the function of the ODMG Object Manipulation Language?

The Object Query Language (OQL) provides declarative access to the object database using an SQL-like syntax. It does not provide explicit update operators, but leaves this to the operations defined on object types. As with SQL, OQL can be used as a standalone language and as a language embedded in another language for which an ODMG binding is defined. The currently supported languages are Smalltalk, C++++, and Java. OQL can also invoke operations programmed in these languages.

OQL can be used both for both associative and navigational access:

o An associative query returns a collection of objects. How these objects are located is the responsibility of the ODMS, rather than the application program.
o A navigational query accesses individual objects and object relationships are used to navigate from one object to another. It is the responsibility of the application program to specify the procedure for accessing the required objects.



See Section 26.2.4.

26.4 How does the ODMG GROUP BY clause differ from the SQL GROUP BY clause? Give an example to illustrate your answer.

In OQL the functionality of the GROUP BY clause has been extended to provide an explicit reference to the collection of objects within each group (which in OQL is called a partition). See Example 26.6.

26.5 How does the ODMG aggregate functions differ from the SQL aggregate functions? Give an example to illustrate your answer.

The OQL aggregate functions can be applied within the select clause or to the result of the select operation. For example, the following two expressions are equivalent in OQL:

SELECT COUNT(s) FROM s IN salesStaff WHERE s.WorksAt.branchNo = ‘B003’;

COUNT(SELECT s FROM s IN salesStaff WHERE s.WorksAt.branchNo = ‘B003’);

Note that OQL allows aggregate operations to be applied to any collection of the appropriate type and, unlike SQL, can be used in any part of the query. For example, the following is allowed in OQL (but not SQL):

SELECT s

FROM s IN salesStaff

WHERE COUNT(s.WorksAt) > 10;

26.6 What is the function of the ODMG Object Interchange Format?

The Object Interchange Format (OIF) is a specification language used to dump and load the current state of an ODMS to or from one or more files. OIF can be used to exchange persistent objects between ODMSs, seed data, provide documentation, and drive test suites. OIF was designed to support all possible ODMS states compliant with the ODMG Object Model and ODL schema definitions. It was also designed according to NCITS (National Committee for Information Technology Standards) and PDES/STEP (Product Data Exchange using STEP, the STandard for the Exchange of Product model data) for mechanical CAD, wherever possible.

See Section 26.2.5.

26.7 Briefly discuss how the ODMG C++ language binding works.

Discussed fully in Section 26.2.5.


Chapter 27 Object-Relational DBMSs
Review Questions


27.1 What functionality would typically be provided by an ORDBMS?

Many different answers here – see, for example, Section 27.2.1.

Expect standard DBMS functionality, plus object management capabilities (types, inheritance, etc.), plus ability to extend query optimizer, and define new index types (see Section 27.5).

27.2 What are the advantages and disadvantages of extending the relational data model?

Advantages

Apart from the advantages of resolving many of the weaknesses of the relational data model cited in Section 24.2, the main advantages of extending the relational data model come from reuse and sharing. Reuse comes from the ability to extend the DBMS server to perform standard functionality centrally, rather than have it coded in each application. If we can embed this functionality in the server, it saves having to define it in each application that needs it, and consequently allows the functionality to be shared by all applications. These advantages also give rise to increased productivity both for the developer and for the end-user.

Another obvious advantage is that the extended relational approach preserves the significant body of knowledge and experience that has gone into developing relational applications. This is a significant advantage, as many organizations would find it prohibitively expensive to change. If the new functionality is designed appropriately, this approach should allow organizations to take advantage of the new extensions in an evolutionary way without losing the benefits of current database features and functions. Thus, an ORDBMS could be introduced in an integrative fashion, as proof-of-concept projects.

Disadvantages

The ORDBMS approach has the obvious disadvantages of complexity and associated increased costs. Further, there are the proponents of the relational approach that believe the essential simplicity and purity of the relational model are lost with these types of extensions. There are also those that believe that the RDBMS is being extended for what will be a minority of applications that do not achieve optimal performance with current relational technology.

In addition, object-oriented purists are not attracted by these extensions either. They argue that the terminology of object-relational systems is revealing. Instead of discussing object models, terms like user-defined data types are used. The terminology of object-orientation abounds with terms like abstract types, class hierarchies, and object models. However, ORDBMS vendors are attempting to portray object models as extensions to the relational model with some additional complexities. This potentially misses the point of object-orientation, highlighting the large semantic gap between these two technologies. Object applications are simply not as data-centric as relational-based ones. Object-oriented models and programs deeply combine relationships and encapsulated objects to more closely mirror the ‘real world’. This defines broader sets of relationships than those expressed in SQL, and involves functional programs interspersed in the object definitions. In fact, objects are fundamentally not extensions of data, but a completely different concept with far greater power to express ‘real-world’ relationships and behaviors.

In Chapter 5, we noted that the objectives of a database language included having the capability to be used with minimal user effort, and having a command structure and syntax that must be relatively easy to learn. Unfortunately, the size of the new SQL3 standard is daunting, and it would seem that these two objectives are no longer being fulfilled or even being considered by the standards bodies.

See Section 27.1 under Advantages and Disadvantages.

27.3 What are the main features of the new SQL standard?

Main features include:

o type constructors for row types and reference types;
o user-defined types (distinct types and structured types) that can participate in supertype/subtype relationships;
o user-defined procedures, functions, and operators;
o type constructors for collection types (arrays, sets, lists, and multisets);
o support for large objects – Binary Large Objects (BLOBs) and Character Large Objects (CLOBs);
o recursion.



See start of Section 27.4.

27.4 Discuss the extensions required to query processing and query optimization to fully support the ORDBMS?

Mechanisms for defining new index structures and giving the query optimizer information about user-defined functions.

See Section 27.5.

27.5 What are the security problems associated with the introduction of user-defined methods and suggest some solutions to these problems?

If the user-defined function (UDF) causes some fatal runtime error, then if the UDF code is linked into the ORDBMS server, the error may have the consequential effect of crashing the server. Clearly, this is something that the ORDBMS has to protect against. One approach is to have all UDFs written in an interpreted language, such as SQL or Java. However, we have already seen that SQL3 allows an external routine, written in a high-level programming language such as ‘C’/C++, to be invoked as a UDF. In this case, an alternative approach is to run the UDF in a different address space to the ORDBMS server, and for the UDF and server to communicate using some form of interprocess communication (IPC). In this case, if the UDF causes a fatal runtime error, the only process affected is that of the UDF.

See paragraph before start of Section 27.5.1.

















Chapter 28 Web Technology and DBMSs
Review Questions


28.1 Discuss each of the following terms:

(a) Internet, intranet, and extranet. See start of Section 28.1 and 28.1.1

(b) World Wide Web. See Section 28.2

(c) HyperText Transfer Protocol (HTTP). See Section 28.2.1

(d) HyperText Markup Language (HTML). See Section 28.2.2

(e) Uniform Resource Locators (URLs). See Section 28.2.3

28.2 Compare and contrast the two-tier client–server architecture for traditional DBMSs with the three tier client–server architecture. Why is the latter architecture more appropriate for the Web?

See Section 28.3.2 (additional information on client–server architecture can be found in Section 2.6.3).

28.3 Discuss the advantages and disadvantages of the Web as a database platform.

Your browser may not support display of this image.Your browser may not support display of this image.

See Section 28.3.3.



28.4 Describe the Common Gateway Interface and server extensions, as approaches for integrating databases onto the Web.

See Section Section 28.5 for description of CGI Section 28.7 for description of server extensions.

28.5 Describe how cookies can be used to store information about a user.

A cookie is a piece of information that the client stores on behalf of the server. The information that is stored in the cookie comes from the server as part of the server’s response to an HTTP request. A client may have many cookies stored at any given time, each one associated with a particular Web site or Web page. Each time the client visits that site/page, the browser packages the cookie with the HTTP request. The Web server can then use the information in the cookie to identify the user and, depending on the nature of the information collected, possibly personalize the appearance of the Web page. The Web server can also add or change the information within the cookie before returning it.

See Section 28.6.

28.6 Discuss the differences between JDBC and SQLJ.

SQLJ is based on static embedded SQL while JDBC is based on dynamic SQL. Thus, SQLJ facilitates static analysis for syntax checking, type checking, and schema checking, which may help produce more reliable programs at the loss of some functionality/flexibility. It also potentially allows the DBMS to generate an execution strategy for the query, thereby improving the performance of the query. JDBC, based on dynamic SQL, allows a calling program to compose SQL at runtime.

JDBC is a low-level middleware tool that provides basic features to interface a Java application with a relational DBMS. Using JDBC, developers need to design a relational schema to which they will map Java objects. Subsequently, to write a Java object to the database, they must write code to map the Java object to the corresponding rows of the corresponding relations, as we illustrated in Section 24.4. A similar procedure is required in the other direction to read a Java object from the database.

See Section 28.8.3.

28.7 Discuss the differences between ASP and JSP.

Both technologies are not that dissimilar. Both are designed to enable developers to separate page design from programming logic through the use of callable components, and both provide an alternative to CGI programming that simplifies Web page development and deployment. However, there are differences:

o Platform and server independence JSP conforms to the ‘Write Once, Run Anywhere’ philosophy of the Java environment. In contrast, ASP is primarily restricted to Microsoft Windows-based platforms. The Java community emphasizes the importance of portability but it has been suggested that many organizations are more interested in interoperability rather than portability.
o Extensibility Although both technologies use a combination of scripting and tagging to create dynamic Web pages, JSP allows developers to extend the JSP tags available. This allows developers to create custom tag libraries that can then be used by other developers, thereby simplifying the development process and reducing development timescales.
o Reusability JSP components are reusable across platforms.
o Security and reliability JSP has the added advantage of benefiting from the in-built Java security model and the inherent Java type safety, making JSP potentially more reliable.



See Section 28.9.4.


Chapter 29 Semistructured Data and XML
Review Questions


29.1 What is semistructured data?

Semistructured data is data that has some structure, but the structure may not be rigid, regular, or complete and generally the data does not conform to a fixed schema (sometimes the terms schema-less or self-describing is used to describe such data). In semistructured data, the information that is normally associated with a schema is contained within the data itself. In some forms of semistructured data there is no separate schema, in others it exists but only places loose constraints on the data.

See Section 29.1.

29.2 Describe the key characteristics of the Object Exchange Model (OEM).

An OEM object can be considered as a quadruple (label, oid, type, value). For example, we can represent the Staff object &4 that contains a name and salary, together with the name object &9 that contains the string ‘Ann Beech’ and the salary object &10 that contains the decimal value 12000 as follows:

{Staff, &4, set, {&9, &10}}

{name, &9, string, ‘Ann Beech’}

{salary, &10, decimal, 12000}

OEM was designed specifically to handle the incompleteness of data, and the structure and type irregularity.

See Section 29.1.1.

29.3 What is XML and how does XML compare to SGML and HTML?

XML is a restricted version of SGML (Standard Generalized Markup Language), designed especially for Web documents. It is a meta-language that enables designers to create their own customized tags to provide functionality not available with HTML. For example, XML supports links that point to multiple documents, as opposed to an HTML link that can reference just one destination document.

XML attempts to provide a similar function to SGML, but is less complex and, at the same time, network-aware. Significantly, XML retains the key SGML advantages of extensibility, structure, and validation. Since XML is a restricted form of SGML, any fully compliant SGML system will be able to read XML documents (although the opposite is not true). However, XML is not intended as a replacement for SGML. Equally well, XML is not intended as a replacement for HTML, which is also based on SGML. Instead, XML is designed to complement HTML by enabling different kinds of data to be exchanged over the Web.

See Section 29.2.

29.4 Discuss the advantages of XML.

Your browser may not support display of this image.


See Section 29.2.

29.5 What is the difference between a well-formed XML document and a valid XML document?

The XML specification provides for two levels of document processing: well-formed and valid. A non-validating processor ensures that an XML document is well-formed before passing the information in the document on to the application. An XML document that conforms to the structural and notational rules of XML is considered well-formed. Among others, well-formed XML documents must conform to the following rules:

o the document must start with the XML declaration ;
o all elements must be contained within one root element;
o elements must be nested in a tree structure without any overlap;
o all non-empty elements must have a start-tag and an end-tag.



A validating processor will not only check that an XML document is well-formed but that it also conforms to a DTD, in which case the XML document is considered valid.

See end of Section 29.2.2.

29.6 Describe the differences between the Document Object Model (DOM) and the Object Exchange Model (OEM).

In the OEM representation, the graph has labels on the edges whereas with the XML representation the graph has labels on the nodes.

See Section 29.3.1.

29.7 Describe the differences between the Document Type Definition (DTD) and the XML Schema.

While XML 1.0 supplies the DTD mechanism for defining the content model (the valid order and nesting of elements) and, to a limited extent, the data types of attributes of an XML document, it has a number of limitations:

o it is written in a different (non-XML) syntax;
o it has no support for namespaces;
o it only offers extremely limited data typing.



The W3C XML Schema overcome these limitations and is much more expressive than DTDs. An XML schema is the definition (both in terms of its organization and its data types) of a specific XML structure. The W3C XML Schema language specifies how each type of element in the schema is defined and what data type that element has associated with it. The schema is itself an XML document, using elements and attributes to express the semantics of the schema. As it is an XML document, it can be edited and processed by the same tools that read the XML it describes.

See Section 29.3.8.

29.8 Describe the W3C proposals for an XML Query Language.

See Section 29.4.5.

29.9 Discuss how the combination of XML and XML Schema may not provide the support for semantic interoperability that we require and how the proposals for RDF and RDF Schema may be more appropriate.

See Section 29.3.9.


Chapter 30 Data Warehousing Concepts
Review Questions


30.1 Describe what is meant by the following terms, when describing the characteristics of the data in a data warehouse:

(a) subject-oriented;

(b) integrated;

(c) time-variant;

(d) non-volatile.

See Section 30.1.2.

30.2 Discuss how Online Transaction Processing (OLTP) systems differ from data warehousing systems.

Your browser may not support display of this image.


See Section 30.1.4.

30.3 Discuss the main benefits and problems associated with data warehousing.

Benefits:

Potential high return on investment

Competitive advantage

Increased productivity of corporate decision-makers

Your browser may not support display of this image.


For the main benefits of data warehousing see Section 30.1.3 and for the main problems associated with data warehousing see Section 30.1.5.

30.4 Present a diagrammatic representation of the typical architecture and main components of a data warehouse.

For a diagram of the typical architecture of a data warehouse see Figure 30.1.

30.5 Describe the characteristics and main functions of the following components of a data warehouse.

(a) load manager See Section 30.2.3

(b) warehouse manager See Section 30.2.4

(c) query manager See Section 30.2.5

(d) meta-data See Section 30.2.9

(e) end-user access tools. See Section 30.2.10

30.6 Discuss the activities associated with each of the five primary information flows or processes within the data warehouse:

(a) Inflow See Section 30.3.1

(b) Upflow See Section 30.3.2

(c) Downflow See Section 30.3.3

(d) Outflow See Section 30.3.4

(e) Metaflow. See Section 30.3.5

30.7 What are the three main approaches taken by vendors to provide data extraction, cleansing, and transformation tools?

The three approaches are code generators, database data replication tools and dynamic transformation engines. See Section 30.4.1 for a description of each approach.

30.8 Describe the specialized requirements of a relational database management system (RDBMS) suitable for use in a data warehouse environment.


Your browser may not support display of this image.


See Section 30.4.2

30.9 Discuss how parallel technologies can support the requirements of the data warehouse.

See last topic discussed in Section 30.4.2 under the heading Parallel database technologies.

30.10 Discuss the importance of managing meta-data and how this relates to the integration of the data warehouse.

See Section 30.4.3.

11. Discuss the main tasks associated with the administration and management of a data warehouse.



The data warehouse administration and management tools must be capable of supporting the following tasks:

o monitoring data loading from multiple sources;
o data quality and integrity checks;
o managing and updating meta-data;
o monitoring database performance to ensure efficient query response times and resource utilization;
o auditing data warehouse usage to provide user chargeback information;
o replicating, subsetting, and distributing data;
o maintaining efficient data storage management;
o purging data;
o archiving and backing-up data;
o implementing recovery following failure;
o security management.



See Section 30.4.4.



30.12 Discuss how data marts differ from data warehouses and discuss the main reasons for implementing a data mart.

For a discussion on how data marts differ form data warehouses see introductory paragraphs of Section 30.5 and for reasons for implementing a data mart see Section 30.5.1.

30.13 Identify the main issues associated with the development and management of data marts.


Your browser may not support display of this image.

See Section 30.5.2.

30.14 Describe the features of Oracle that support the core requirements of data warehousing.



Chapter 31 Data Warehousing Design
Review Questions


31.1 Identify the major issues associated with designing a data warehouse database.

Need answers for questions such as: which user requirements are most important and which data should be considered first? Also, should the project be scaled down into something more manageable yet at the same time provide an infrastructure capable of ultimately delivering a full-scale enterprise-wide data warehouse?

See Section 31.1.

31.2 Describe how a dimensional model (DM) differs from an Entity–Relationship (ER) model.

Dimensionality modeling uses the concepts of ER modeling with some important restrictions. Every dimensional model (DM) is composed of one table with a composite primary key, called the fact table, and a set of smaller tables called dimension tables. Each dimension table has a simple (non-composite) primary key that corresponds exactly to one of the components of the composite key in the fact table. In other words, the primary key of the fact table is made up of two or more foreign keys. This characteristic ‘star-like’ structure is called a star schema or star join.

Another important feature of a DM is that all natural keys are replaced with surrogate keys. This means that every join between fact and dimension tables is based on surrogate keys, not natural keys. Each surrogate key should have a generalized structure based on simple integers. The use of surrogate keys allows the data in the warehouse to have some independence from the data used and produced by the OLTP systems.

See Section 31.2.

31.3 Present a diagrammatic representation of a typical star schema.

See, for example, Figure 31.1.

31.4 Describe how the fact and dimensional tables of a star schema differ.

See answer to Review Question 31.2 above.

31.5 Describe how star, snowflake, and starflake schemas differ.

Star schema is a logical structure that has a fact table containing factual data in the center, surrounded by dimension tables containing reference data (which can be denormalized).

Snowflake schema is a variant of the star schema where dimension tables do not contain denormalized data.

Starflake schema is a hybrid structure that contains a mixture of star and snowflake schemas.

See Section 31.2.

31.6 The star, snowflake, and starflake schemas offer important advantages in a data warehouse environment. Describe these advantages.

Advantages include:

* Efficiency The consistency of the underlying database structure allows more efficient access to the data by various tools including report writers and query tools.
* Ability to handle changing requirements The star schema can adapt to changes in the user’s requirements, as all dimensions are equivalent in terms of providing access to the fact table. This means that the design is better able to support ad hoc user queries.
* Extensibility The dimensional model is extensible; for example typical changes that a DM must support include: (a) adding new facts as long as they are consistent with the fundamental granularity of the existing fact table; (b) adding new dimensions, as long as there is a single value of that dimension defined for each existing fact record; (c) adding new dimensional attributes; and (d) breaking existing dimension records down to a lower level of granularity from a certain point in time forward.
* Ability to model common business situations There are a growing number of standard approaches for handling common modeling situations in the business world. Each of these situations has a well-understood set of alternatives that can be specifically programmed in report writers, query tools, and other user interfaces; for example, slowly changing dimensions where a ‘constant’ dimension such as Branch or Staff actually evolves slowly and asynchronously.
* Predictable query processing Data warehouse applications that drill down will simply be adding more dimension attributes from within a single star schema. Applications that drill across will be linking separate fact tables together through the shared (conformed) dimensions. Even though the overall suite of star schemas in the enterprise dimensional model is complex, the query processing is very predictable because at the lowest level, each fact table should be queried independently.



See Section 31.2.

31.7 Describe the main activities associated with each step of the Nine-Step Methodology for data warehouse database design.

Your browser may not support display of this image.

See Section 31.3.

31.8 Describe the purpose of assessing the dimensionality of a data warehouse.

The purpose is to establish an objective standard for assessing how well a system supports the dimensional view of data warehousing, and to set the threshold high so that vendors have a target for improving their systems.

See Section 31.4.



31.9 Briefly outline the criteria groups used to assess the dimensionality of a data warehouse.

Your browser may not support display of this image.


See Section 31.4.

31.10 Describe how the Oracle Warehouse Builder supports the design of a data warehouse.

Described in Section 31.5.2.


Chapter 32 OLAP and Data Mining
Review Questions


32.1 Discuss what online analytical processing (OLAP) is and how OLAP differs from data warehousing.

Online analytical processing (OLAP) The dynamic synthesis, analysis, and consolidation of large volumes of multi-dimensional data. The key characteristics of OLAP applications include multi-dimensional views of data, support for complex calculations, and time intelligence.

See Section 32.1.

32.2 Describe OLAP applications and identify the characteristics of such applications.

Your browser may not support display of this image.

See Section 32.1.2.

32.3 Discuss the characteristics of multi-dimensional data and how this can be best represented.

Multi-dimensional structures are best visualized as cobes of data, and cubes within cubes. Each side of a cube is a dimension.

See Section 32.1.



32.4 Describe Codd’s rule for OLAP tools.

Your browser may not support display of this image.

See Section 32.1.5.

32.5 Describe the architecture, characteristics, and issues associated with each of the following categories of OLAP tools:

(a) MOLAP,

(b) ROLAP,

(c) MQE.

Discussed in Section 32.1.6 under each of these headings.



32.6 Discuss how OLAP extensions to SQL can support data analysis and decision-support applications.



See Section 32.1.7 for discussion of Red Brick Intelligence SQL (RISQL).

32.7 Discuss how data mining can realize the value of a data warehouse.

See introductory paragraphs of Section 32.2 and see Section 32.2.1. See also Section 32.2.8.

32.8 Describe the characteristics, associated techniques, and typical applications for each of the following main data mining operations:

(a) Predictive modeling, See Section 32.2.3

(b) Database segmentation, See Section 32.2.4

(c) Link analysis, See Section 32.2.5

(d) Deviation detection. See Section 32.2.6

See Section 32.2.2 for introduction to the techniques.