0% found this document useful (0 votes)
17 views14 pages

Com 322 Database 2

The document outlines a course titled 'Database Design 2' at Delta Central College, detailing various topics and questions related to object-oriented databases, relational databases, file organization, and query processing. It covers definitions, comparisons, advantages, and disadvantages of object-oriented databases, as well as concepts like functional dependency, normalization, and ACID properties. The document serves as an examination guide for students in the Computer Science department, with specific questions and marking schemes provided.

Uploaded by

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

Com 322 Database 2

The document outlines a course titled 'Database Design 2' at Delta Central College, detailing various topics and questions related to object-oriented databases, relational databases, file organization, and query processing. It covers definitions, comparisons, advantages, and disadvantages of object-oriented databases, as well as concepts like functional dependency, normalization, and ACID properties. The document serves as an examination guide for students in the Computer Science department, with specific questions and marking schemes provided.

Uploaded by

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

DELTA CENTRAL COLLEGE OF MANAGEMENT AND SCIENCES

(DECCOMS)
IN AFFILIATION WITH
TEMPLE GATE POLYTECHNIC
ABA, ABIA STATE.
COURSE TITLE: DATABASE DESIGN 2
COURSE CODE: COM 322 DEPARTMENTS: COMPUTER SCIENCE
TIME ALLOWED: 2 HOURS INSTRUCTIONS: ANSWER FIVE QUESTIONS
QUESTION 1
1a. What is an object-oriented database (2 marks)
1b. Where Are Object-Oriented Databases Used? (4 marks)
1c. Explain the various components of Object-Oriented Data Models (8 marks)
QUESTION 2
2a. What is the difference between a relational database and object-oriented (4 marks)
2b. What Are the Advantages of Object-Oriented Databases? (4 marks)
2c. What Are the Disadvantages of Object-Oriented Databases? (6 marks)
QUESTION 3
3a. Define the following terms
Functional dependency
Armstrong’s axioms
Trivial functional dependency
Normalization (8 marks)
3b. what do you understand by “join” (2 marks)
3c. Write down the signs/symbols of the following terms
Theta
Notation
Natural join
Full outer join (4 MARKS)
QUESTION 4
4a. Explain the various categories that storage device can be categorized (9 marks)
4b. Explain Redundant Array of Independent Disks. Give examples (3 marks)
4c. Name two types of file organization (2 marks)
QUESTION 5
5a. File operations can be broadly classified into two categories. Discuss these categories
(4 marks)
5b. Explain the three types of index attributes (6 marks)
5c. Write short notes on sparse index and multilevel index (4 marks)
QUESTION 6
6a. Define Query Processing and highlight three steps involved (5 marks)

6b. A transaction is a very small unit of a program and it may contain several low level tasks. A
transaction in a database system must maintain “ACID properties”. Using the acronym, explain
the terms. (10 marks)
QUESTION 7
7a. Write short notes on the following terms
Result equivalence
View equivalence
Conflict equivalence (12 marks)

7b. List two states of transaction (2 marks)


MARKING SCHEME
1a. What is an object-oriented database (2 marks)

An object-oriented database (OOD) is a database system that can work with complex data
objects — that is, objects that mirror those used in object-oriented programming languages.

1b. Where Are Object-Oriented Databases Used? (4 marks)

OODs are most often used with object-oriented programming languages like Java, Kotlin, C#,
Node JS (React), and Swift. Industries that use OODs are typically those built on an object-
oriented language and wanting to boost productivity while working with complex data structures.

One good example of an OOD is online IT training provider CBT Nuggets. CBT Nuggets uses
Realm to offer more than 5,000 courses ranging from basic computer skills to complex network
management (see this case study). CBT Nuggets works to ensure subscribers can view content
from anywhere, at any time. To meet this promise, classes are delivered through streaming
videos that range from 10- to 20-minute “nuggets.” Content is available on both desktop and
through a mobile app.

With the Realm and MongoDB Atlas Device Sync, CBT was able to develop using the cross-
platform SDKS for Android and iOS devices using direct object-to-business class mapping and
seamless sync to MongoDB Atlas.

1c. Explain the various components of Object-Oriented Data Models (8 marks)

The elements of a OODM are:

 Object: A real world entity, such as a specific life task in a to-do list-“take the garbage
out”.
 Attributes and Methods: An object has state and behaviors. An object has properties
(which might also be called attributes) like name, status, and create_date. The set of
properties taken together represents its state. Along with this, an object has behaviors
(also known as methods, actions, or functions) that modify or operate on its properties,
like update_task() or get_task_history().
 Class: The grouping of all objects with the same properties and behaviors form a class. In
our example above, we talked about task objects. These objects together all belong to
the Task class.

 Object-Oriented Design Patterns: Object-oriented data modeling also implies certain


principles like inheritance, polymorphism, overriding, and association. An object-
oriented database system will support these same concepts.

2a. What is the difference between a relational database and object-oriented (4 marks)

Relational Versus Object-Oriented Databases

What Is the Difference Between a Relational Database and Object-Oriented?

Relational database management systems (RDBMS) work with tables, with each row in the table
representing a record. The columns in a row represent the attributes of an individual record.
Associations between records (“A Company has many Employees. An Employee belongs to a
Company”) are facilitated with foreign keys in one table referencing IDs in another table. These
associations make up the “relational” part of relational databases.

Data values stored in relational databases are atomic and primitive. By primitive, we mean that
they are types like characters, text strings, numbers, and hashes. Even though MySQL and
SQLite support the JSON (JavaScript Object Notation) data type, that’s not the same as
supporting objects in the sense that OODs do.

Contrast this with the OOD, which typically stores and manages objects directly on the database
server’s disk. There are no tables, no rows, no columns, no foreign keys. There are only objects.

Associations between objects in an OOD can also be established and persist, which can lead to
powerful and fast querying of data across complex relationships.

2b. What Are the Advantages of Object-Oriented Databases? (4 marks)

What Are the Advantages of Object-Oriented Databases?

With all of their complex associations to other objects, and because mplex data objects persist in
an OOD, the most significant advantage of the OOD over RDBMS is the ability to query across
these complex relationships very quickly.
 There are no slow “joins” as in an RDBMS. Instead, you have fast queries with complex
data.
 Since the database structure is so close to the programming objects, the code is simpler
and lighter.

As another example, we might think back to our task object instance, which cannot be stored as-
is in MySQL. It needs first to be decomposed into its attributes to be stored in the table as a row
with columns. The reverse process will involve retrieval and composition. Not so with object-
oriented or document databases. Have an object? Store the whole thing in the database.

2c. What Are the Disadvantages of Object-Oriented Databases? (6 marks)

What Are the Disadvantages of Object-Oriented Databases?

An OOD may be a great choice if you’re using an object-oriented programming language and
need to manage complex data with complex object-to-object associations. Designing and
optimizing a database system for these kinds of complexities, however, also has its trade-offs.

For one thing, the relative performance of very simple database operations — the ones you might
do for a simple lookup of an attribute from a relational database table— may be sub-optimal.

Additionally, while users of RDBMS can enjoy a standard query language (SQL), users of
object-oriented database systems may not have widely adopted standards at their disposal. For
the most part, each flavor of OOD is coupled tightly to an object-oriented programming
language, and querying syntax is very language-dependent.

Lastly, the OOD user community still feels small in comparison to the exploding ecosystem of
web development within the RDBMS space. But the community is fast-growing and likely to
make up for lost time.

3a. Define the following terms

Functional dependency

Armstrong’s axioms

Trivial functional dependency

Normalization (8 marks)
Functional Dependency

Functional dependency (FD) is a set of constraints between two attributes in a relation.


Functional dependency says that if two tuples have same values for attributes A1, A2,..., An,
then those two tuples must have to have same values for attributes B1, B2, ..., Bn.
Functional dependency is represented by an arrow sign (→) that is, X→Y, where X functionally
determines Y. The left-hand side attributes determine the values of attributes on the right-hand
side.

Armstrong's Axioms

If F is a set of functional dependencies then the closure of F, denoted as F +, is the set of all
functional dependencies logically implied by F. Armstrong's Axioms are a set of rules, that when
applied repeatedly, generates a closure of functional dependencies.
 Reflexive rule − If alpha is a set of attributes and beta is_subset_of alpha, then alpha
holds beta.
 Augmentation rule − If a → b holds and y is attribute set, then ay → by also holds. That
is adding attributes in dependencies, does not change the basic dependencies.
 Transitivity rule − Same as transitive rule in algebra, if a → b holds and b → c holds,
then a → c also holds. a → b is called as a functionally that determines b.

Trivial Functional Dependency

 Trivial − If a functional dependency (FD) X → Y holds, where Y is a subset of X, then it


is called a trivial FD. Trivial FDs always hold.
 Non-trivial − If an FD X → Y holds, where Y is not a subset of X, then it is called a
non-trivial FD.
 Completely non-trivial − If an FD X → Y holds, where x intersects Y = Φ, it is said to
be a completely non-trivial FD.

Normalization

If a database design is not perfect, it may contain anomalies, which are like a bad dream for any
database administrator. Managing a database with anomalies is next to impossible.
 Update anomalies − If data items are scattered and are not linked to each other properly,
then it could lead to strange situations. For example, when we try to update one data item
having its copies scattered over several places, a few instances get updated properly while
a few others are left with old values. Such instances leave the database in an inconsistent
state.
 Deletion anomalies − We tried to delete a record, but parts of it was left undeleted
because of unawareness, the data is also saved somewhere else.
 Insert anomalies − We tried to insert data in a record that does not exist at all.
Normalization is a method to remove all these anomalies and bring the database to a consistent
state.
3b. what do you understand by “join” (2 marks)

Join is a combination of a Cartesian product followed by a selection process. A Join operation


pairs two tuples from different relations, if and only if a given join condition is satisfied.
3c. Write down the signs/symbols of the following terms
Theta
Notation
Natural join
Full outer join

4a. Explain the various categories that storage device can be categorized (9 marks)
CHAPTER TWO
FILE AND PHYSICAL STORAGE
Databases are stored in file formats, which contain records. At physical level, the actual data is
stored in electromagnetic format on some device. These storage devices can be broadly
categorized into three types −
 Primary Storage − The memory storage that is directly accessible to the CPU comes
under this category. CPU's internal memory (registers), fast memory (cache), and main
memory (RAM) are directly accessible to the CPU, as they are all placed on the
motherboard or CPU chipset. This storage is typically very small, ultra-fast, and volatile.
Primary storage requires continuous power supply in order to maintain its state. In case of
a power failure, all its data is lost.
 Secondary Storage − Secondary storage devices are used to store data for future use or
as backup. Secondary storage includes memory devices that are not a part of the CPU
chipset or motherboard, for example, magnetic disks, optical disks (DVD, CD, etc.), hard
disks, flash drives, and magnetic tapes.
 Tertiary Storage − Tertiary storage is used to store huge volumes of data. Since such
storage devices are external to the computer system, they are the slowest in speed. These
storage devices are mostly used to take the back up of an entire system. Optical disks and
magnetic tapes are widely used as tertiary storage.

4b. Explain Redundant Array of Independent Disks. Give examples (3 marks)

RAID or Redundant Array of Independent Disks, is a technology to connect multiple secondary


storage devices and use them as a single storage media.
RAID consists of an array of disks in which multiple disks are connected together to achieve
different goals. RAID levels define the use of disk arrays.
4c. Name two types of file organization (2 marks)
File Organization defines how file records are mapped onto disk blocks. We have four types of
File Organization to organize file records −
5a. File operations can be broadly classified into two categories. Discuss these categories
(4 marks)

File Operations

Operations on database files can be broadly classified into two categories −


 Update Operations
 Retrieval Operations
Update operations change the data values by insertion, deletion, or update. Retrieval operations,
on the other hand, do not alter the data but retrieve them after optional conditional filtering. In
both types of operations, selection plays a significant role. Other than creation and deletion of a
file, there could be several operations, which can be done on files.
5b. Explain the three types of index attributes (6 marks)
 Primary Index − Primary index is defined on an ordered data file. The data file is
ordered on a key field. The key field is generally the primary key of the relation.
 Secondary Index − Secondary index may be generated from a field which is a candidate
key and has a unique value in every record, or a non-key with duplicate values.
 Clustering Index − Clustering index is defined on an ordered data file. The data file is
ordered on a non-key field.

5c. Write short notes on sparse index and multilevel index (4 marks)

Sparse Index

In sparse index, index records are not created for every search key. An index record here
contains a search key and an actual pointer to the data on the disk. To search a record, we first
proceed by index record and reach at the actual location of the data. If the data we are looking for
is not where we directly reach by following the index, then the system starts sequential search
until the desired data is found.

Multilevel Index

Index records comprise search-key values and data pointers. Multilevel index is stored on the
disk along with the actual database files. As the size of the database grows, so does the size of
the indices. There is an immense need to keep the index records in the main memory so as to
speed up the search operations. If single-level index is used, then a large size index cannot be
kept in memory which leads to multiple disk accesses.

6a. Define Query Processing and highlight three steps involved (5 marks)

Query Processing is the activity performed in extracting data from the database. In
query processing, it takes various steps for fetching the data from the database. The
steps involved are:

1. Parsing and translation

2. Optimization

3. Evaluation

6b. A transaction is a very small unit of a program and it may contain several low level tasks. A
transaction in a database system must maintain “ACID properties”. Using the acronym, explain
the terms. (10 marks)

 Atomicity − This property states that a transaction must be treated as an atomic unit, that
is, either all of its operations are executed or none. There must be no state in a database
where a transaction is left partially completed. States should be defined either before the
execution of the transaction or after the execution/abortion/failure of the transaction.
 Consistency − The database must remain in a consistent state after any transaction. No
transaction should have any adverse effect on the data residing in the database. If the
database was in a consistent state before the execution of a transaction, it must remain
consistent after the execution of the transaction as well.
 Durability − The database should be durable enough to hold all its latest updates even if
the system fails or restarts. If a transaction updates a chunk of data in a database and
commits, then the database will hold the modified data. If a transaction commits but the
system fails before the data could be written on to the disk, then that data will be updated
once the system springs back into action.
 Isolation − In a database system where more than one transaction is being executed
simultaneously and in parallel, the property of isolation states that all the transactions will
be carried out and executed as if it is the only transaction in the system. No transaction
will affect the existence of any other transaction.

7a. Write short notes on the following terms

Result equivalence

View equivalence

Conflict equivalence

Result Equivalence
If two schedules produce the same result after execution, they are said to be result equivalent.
They may yield the same result for some value and different results for another set of values.
That's why this equivalence is not generally considered significant.
View Equivalence
Two schedules would be view equivalence if the transactions in both the schedules perform
similar actions in a similar manner.
For example −
 If T reads the initial data in S1, then it also reads the initial data in S2.
 If T reads the value written by J in S1, then it also reads the value written by J in S2.
 If T performs the final write on the data value in S1, then it also performs the final write
on the data value in S2.
Conflict Equivalence
Two schedules would be conflicting if they have the following properties −
 Both belong to separate transactions.
 Both accesses the same data item.
 At least one of them is "write" operation.
Two schedules having multiple transactions with conflicting operations are said to be conflict
equivalent if and only if −
 Both the schedules contain the same set of Transactions.
 The order of conflicting pairs of operation is maintained in both the schedules.
Note − View equivalent schedules are view serializable and conflict equivalent schedules are
conflict serializable. All conflict serializable schedules are view serializable too.

7b. List two states of transaction (2 marks)

States of Transactions

 Active − In this state, the transaction is being executed. This is the initial state of every
transaction.
 Partially Committed − When a transaction executes its final operation, it is said to be in
a partially committed state.
 Failed − A transaction is said to be in a failed state if any of the checks made by the
database recovery system fails. A failed transaction can no longer proceed further.
 Aborted − If any of the checks fails and the transaction has reached a failed state, then
the recovery manager rolls back all its write operations on the database to bring the
database back to its original state where it was prior to the execution of the transaction.
Transactions in this state are called aborted. The database recovery module can select one
of the two operations after a transaction aborts −
o Re-start the transaction
o Kill the transaction
 Committed − If a transaction executes all its operations successfully, it is said to be
committed. All its effects are now permanently established on the database system.

8a. There are different fields where a database management system is utilized. List the
twelve (12) applications which utilize the information based on administration framework
(12 marks)

DBMS APPLICATIONS
There are different fields where a database management system is utilized. Following are a few
applications which utilize the information base administration framework –

1. Railway Reservation System –

In the rail route reservation framework, the information base is needed to store the record
or information of ticket appointments, status about train’s appearance, and flight.
Additionally, if trains get late, individuals become acquainted with it through the
information base update.

2. Library Management System –


There are lots of books in the library so; it is difficult to store the record of the relative
multitude of books in a register or duplicate. Along these lines, the data set administration
framework (DBMS) is utilized to keep up all the data identified with the name of the book,
issue date, accessibility of the book, and its writer.

3. Banking –
Database the executive’s framework is utilized to store the exchange data of the client in
the information base.

4. Education Sector –
Presently, assessments are led online by numerous schools and colleges. They deal with all
assessment information through the data set administration framework (DBMS). In spite of
that understudy’s enlistments subtleties, grades, courses, expense, participation, results, and
so forth all the data is put away in the information base.

5. Credit card exchanges –


The database Management framework is utilized for buying on charge cards and age of
month to month proclamations.

6. Social Media Sites –


We all utilization of online media sites to associate with companions and to impart our
perspectives to the world. Every day, many people group pursue these online media
accounts like Pinterest, Facebook, Twitter, and Google in addition to. By the utilization of
the data set administration framework, all the data of clients are put away in the
information base and, we become ready to interface with others.

7. Broadcast communications –
Without DBMS any media transmission organization can’t think. The Database the
executive’s framework is fundamental for these organizations to store the call subtleties
and month to month postpaid bills in the information base.

8. Account –
The information base administration framework is utilized for putting away data about
deals, holding and acquisition of monetary instruments, for example, stocks and bonds in a
data set.

9. Online Shopping –
These days, web-based shopping has become a major pattern. Nobody needs to visit the
shop and burn through their time. Everybody needs to shop through web based shopping
sites, (for example, Amazon, Flipkart, Snapdeal) from home. So all the items are sold and
added uniquely with the assistance of the information base administration framework
(DBMS). Receipt charges, installments, buy data these are finished with the assistance of
DBMS.

10. Human Resource Management –


Big firms or organizations have numerous specialists or representatives working under
them. They store data about worker’s compensation, assessment, and work with the
assistance of an information base administration framework (DBMS).

11. Manufacturing –
Manufacturing organizations make various kinds of items and deal them consistently. To
keep the data about their items like bills, acquisition of the item, amount, inventory
network the executives, information base administration framework (DBMS) is utilized.

12. Airline Reservation System –


This framework is equivalent to the railroad reservation framework. This framework
additionally utilizes an information base administration framework to store the records of
flight takeoff, appearance, and defer status.

You might also like