Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Dbms Assignment 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

1a. Discuss the main characteristics of database approach.

The main characteristics of the database approach versus the file-processing approach are the following:
 Self-describing nature of a database system
 Insulation between programs and data, and data abstraction
 Support of multiple views of the data
 Sharing of data and multiuser transaction processing
Self- Nature of a Database System Describing
DB approach
• A fundamental characteristic of the database approach is that the database system contains not only the
database itself but also a complete definition or description of the database structure and constraints.
• This definition is stored in the DBMS catalog, which contains information such as the structure of each
file, the type and storage format of each data item, and various constraints on the data.
• The information stored in the catalog is calledmeta-data, and it describes the structure of the primary
database.
• Whenever a request is made to access, say, the Name of a STUDENT record, the DBMS software refers
to the catalog to determine the structure of the STUDENT file and the position and size of the Name data
item within a STUDENT record
Traditional file processing
• In traditional file processing, data definition is typically part of the application programs themselves.
Hence, these programs are constrained to work with only one specific database, whose structure is
declared in the application programs.
• In a typical file-processing application, the file structure and, in the extreme case, the exact location of
Name within a STUDENT record are already coded within each program that accesses this data item

Insulation between programs and data, and data abstraction


• In traditional file processing, the structure of data files is embedded in the application programs, so any
changes to the structure of a file may require changing all programs that access that file.
• For example, a file access program may be written in such a way that it can access only STUDENT
records of the structure, If we want to add another piece of data to each STUDENT record, say the
Birthdate, such a program will no longer work and must be changed
DB approach
• By contrast, DBMS access programs do not require such changes in most cases. The structure of data
files is stored in the DBMS catalog separately from the access programs. We call this property program-
data independence
• By contrast, in a DBMS environment, we only need to change the description of STUDENT records in
the catalog to reflect the inclusion of the new data item Birth
date; no programs are changed. The next time a DBMS program refers to the catalog, the new structure of
STUDENT records will be accessed and used
 In an object-oriented and object-relational systems, An operation (also called a function or method) is
specified in two parts. The interface (or signature) of an operation includes the operation name and the
data types of its arguments (or parameters).
 The implementation (or method) of the operation is specified separately and can be changed without
affecting the interface. User application programs can operate on the data by invoking these operations
through their names and arguments, regardless of how the operations are implemented. This may be
termed program-operation independence
 The characteristic that allows program-data independence and program-operation independence is
called data abstraction

Support of Multiple Views of the Data


• A database typically has many types of users, each of whom may require a different perspective or view
of the database
• A view may be a subset of the database or it may contain virtual data that is derived from the database
files but is not explicitly stored.
• A multiuser DBMS whose users have a variety of distinct applications must provide facilities for
defining multiple views
• For example, one user of the database may be interested only in accessing and printing the transcript of
each student. A second user, who is interested only in checking that students have taken all the
prerequisites of each course for which the student registers, may require the view

Sharing of Data and Multiuser Transaction Processing


• A multiuser DBMS, as its name implies, must allow multiple users to access the database at the same
time.
• This is essential if data for multiple applications is to be integrated and maintained in a single database.
• A fundamental role of multiuser DBMS software is to ensure that concurrent transactions operate
correctly and efficiently
• A transaction is an executing program or process that includes one or more database accesses, such as
reading or updating of database records.
• The DBMS must enforce several transaction properties. The isolation property ensures that each
transaction appears to execute in isolation from other transactions, even though hundreds of transactions
may be executing concurrently. The atomicity property ensures that either all the database operations in a
transaction are executed or none are.

1b. what is Data independence? Explain different types of data independence?


Data independence, which can be defined as the capacity to change the schema at one level of a database
system without having to change the schema at the next higher level.
We can define two types of data independence:
1. Logical data independence:-
-capacity to change the conceptual schema without having to change external schemas or
application programs
-change the conceptual schema to expand the database, to change constraints, or to reduce the
database
-changes to constraints can be applied to the conceptual schema without affecting the external
schemas or application programs
2. Physical data independence:-
-capacity to change the internal schema without having to change the conceptual schema. Hence, the
external schemas need not be changed as well
-by creating additional access structures—to improve the performance of retrieval or update.

2a. List advantages of DBMS over traditional file systems. Briefly explain them.
1.Controlling Redundancy: Data redundancy (such as tends to occur in the "file processing" approach)
leads to wasted storage space, duplication of effort (when multiple copies of a datum need to be updated),
and a higher likelihood of the introduction of inconsistency. On the other hand, redundancy can be used to
improve performance of queries. Indexes, for example, are entirely redundant, but help the DBMS in
processing queries more quickly. A DBMS should provide the capability to automatically enforce the rule
that no inconsistencies are introduced when data is updated.
2. Restricting Unauthorized Access: A DBMS should provide a security and authorization subsystem,
which the DBA uses to create accounts and to specify account restrictions. Then, the DBMS should
enforce these restrictions automatically.
3. Providing Persistent Storage for Program Objects: Object-oriented database systems make it easier
for complex runtime objects (e.g., lists, trees) to be saved in secondary storage so as to survive beyond
program termination and to be retrievable at a later time.
4. Providing Storage Structures and Search Techniques for Efficient Query Processing: Database
systems must provide capabilities for efficiently executing queries and updates. The query processing and
optimization module of the DBMS is responsible for choosing an efficient query execution plan for each
query based on the existing storage structures.
5. Providing Backup and Recovery: A DBMS must provide facilities for recovering from hardware or
software failures. The backup and recovery subsystem of the DBMS is responsible for recovery. The
recovery subsystem could ensure that the transaction is resumed from the point at which it was interrupted
so that its full effect is recorded in the database
6. Providing Multiple User Interfaces: Many types of users with varying levels of technical knowledge
use a database, a DBMS should provide a variety of user interfaces. For example, query languages for
casual users, programming language interfaces for application programmers, forms and/or command
codes for parametric users, menu-driven interfaces for standalone users.
7. Representing Complex Relationships Among Data: A DBMS must have the capability to represent a
variety of complex relationships among the data, to define new relationships as they arise, and to retrieve
and update related data easily and efficiently.
8. Enforcing Integrity Constraints: Most database applications have certain integrity constraints that
must hold for the data. The simplest type of integrity constraint involves specifying a data type for each
data item. A more complex type of constraint that frequently occurs involves specifying that a record in
one file must be related to records in other files. This is known as a referential integrity constraint.
Another type of constraint specifies uniqueness on data item values, this is known as a key or uniqueness
constraint
9. Permitting Inferencing and Actions Via Rules:
In a deductive database system, one may specify declarative rules that allow the database to infer new
data
E.g., Figure out which students are on academic probation. Such capabilities would take the place of
application programs that would be used to ascertain such information otherwise.
Active database systems go one step further by allowing "active rules" that can be used to initiate actions
automatically

2b. Explain the components modules of DBMS and their interactions.


The figure is divided into two parts.
The top part of the figure refers to the various users of the database environment and their interfaces.
The lower part shows the internals of the DBMS responsible for storage of data and processing of
transactions. The database and the DBMS catalog are usually stored on disk. Access to the disk is
controlled primarily by the operating system (OS), which schedules disk read/write.
Many DBMSs have their own buffer management module to schedule disk read/write.
Stored data manager controls access to DBMS information that is stored on disk, whether it is part of the
or the catalog.
Top half database figure:
 it shows interfaces for the DBA staff, casual users who work with interactive interfaces to formulate
queries
 application programmers who create programs using some host programming languages
 parametric users who do data entry work by supplying parameters to predefined transactions.
 the DBA staff works on defining the database and tuning it by making changes to its definition using
the DDL and other privileged commands
DBA staff:
 The DDL compiler processes schema definitions, specified in the DDL, and stores descriptions of the
schemas (meta-data) in the DBMS catalog
 The catalog includes information such as the names and sizes of files, names and data types of data
items, storage details of each file, mapping information among schemas, and constraints
Casual users:
 interact using some form of interface, which we call the interactive query interface
 queries are parsed and validated for correctness of the query syntax, the names of files anddata
elements, and so on by a query compiler that compiles them into an internal form
 This internal query is subjected to query optimization
 query optimizer is concerned with the rearrangement and possible reordering of operations, elimination
of redundancies, and use of correct algorithms and indexes during execution.
 It consults the system catalog for statistical and other physical information about the stored data and
generates executable code that performs the necessary operations for the query and makes calls on the
runtime processor
Application programmers
 write programs in host languages such as Java, C, or C++ that are submitted to a precompiler
 precompiler extracts DML commands from an application program
 commands are sent to the DML compiler for compilation
 rest of the program is sent to the host language compiler
 The object codes for the DML commands and the rest of the program are linked, forming a canned
transaction
 An example is a bank withdrawal transaction where the account number and the amount may be
supplied as parameters

In the lower part of Figure,


 the runtime database processor executes
(1) .thePrivileged commands
(2) the executable query plans, and
(3) the canned transactions with runtime parameters.
 It works with the system catalog and may update it with statistics
 It also works with the stored data manager, which in turn uses basic operating system services for
carrying out low-level input/output (read/write) operations between the disk and main memory
 The runtime database processor handles other aspects of data transfer, such as management of buffers
concurrency control and backup and recovery systems, integrated into the working of the runtime
database processor for purposes of transaction management
3a. Explain the three-schema architecture
The goal of the three-schema architecture is to separate the user applications from th
Th
The physical address
In this architecture, schemas can be defined at the following three levels:
1. The internal level has an internal schema,
-describes the physical storage structure of the database.
-uses a physical data model and describes the complete details of data storage and access paths for the
database
2. The conceptual level has a conceptual schema,
-describes the structure of the whole database for a community of users
-hides the details of physical storage structures and concentrates on describing entities, data types,
relationships, user operations, and constraints
-representational data model is used to describe the conceptual schema when a database system is
implemented
-This implementation conceptual schema is often based on a conceptual schema design in a high-level
data model
3. The external or view level includes a number of external schemas or user views,
-describes the part of the database that a particular user group is interested in and hides the rest of the
database from that user group.
-As in the previous level, each external schema is typically implemented using a representational data
model, possibly based on an external schema design in a high-level data model.

3b.Why do we need mapping between schema levels


The DBMS must transform a request specified on an external schema into a request against the
conceptual schema, and then into a request on the internal schema for processing over the stored database.
If the request is a database retrieval, the data extracted from the stored database must be reformatted to
match the user’s external view. The processes of transforming requests and results between levels are
called mappings. These mappings may be time-consuming, so some DBMSs—especially those that are
meant to support small databases—do not support external views. Even in such systems, however, a
certain amount of mapping is necessary to transform requests between the conceptual and internal levels.

a. Explain different phases of database design with block diagram.


The main phases of database design are:
 Requirements Collection and Analysis: purpose is to produce a description of the users' requirements.
 Conceptual Design: purpose is to produce a conceptual schema for the database, including detailed
descriptions of entity types, relationship types, and constraints. All these are expressed in terms provided
by the data modelbeing used.
Eg: ER model
 Implementation: purpose is to transform the conceptual schema (which is at a high/abstract level) into a
(lowerlevel) representational/implementational model supported by whatever DBMS is to be used.
 Physical Design: purpose is to decide upon the internal storage structures, access paths (indexes), etc.,
that will be used in realizing the representational model produced in previous phase.

4b. Explain different types of end users with main activities of each.
End users are the people whose jobs require access to the database for querying, updating, and generating
report.
There are several categories of end users:
■Casual end users occasionally access the database, but they may need different information each time.
They use a sophisticated database query language to specify their requests and are typically middle- or
high-level managers or other occasional browsers.
■Naive or parametric end users make up a sizable portion of database end users. Their main job function
revolves around constantly querying and updating the database, using standard types of queries and
updates—called canned transactions—that have been carefully programmed and tested.
The tasks that such users perform are varied:
 Bank tellers check account balances and post withdrawals and deposits.
 Reservation agents for airlines, hotels, and car rental companies check availability for a given request
and make reservations.
 shipping clerks (e.g., at UPS) who use buttons, bar code scanners, etc., to update status of in-transit
packages.
■Sophisticated end users include engineers, scientists, business analysts, and others who thoroughly
familiarize themselves with the facilities of the DBMS in order to implement their own applications to
meet their complex requirements
■Stand-alone users Use "personal" databases, possibly employing a special purpose (e.g., financial)
software package. Mostly maintain personal databases using ready-to-use packaged applications.
An example is a tax program user that creates its own internal database.

5a. List the summary of the notations for ER diagrams. Include symbols used in ER diagrams and their
meaning
5b. Explain different types of attributes that occur in ER model with an example.
Types of attributes occur in the ER model
 simple versus composite
 single valued versus multivalued
 stored versus derived

Composite attributes can be divided into smaller subparts.


For eg: the Address attribute of the EMPLOYEE entity can be subdivided into Street_address, City, State,
and Zip, 3 with the values ‘2311 Kirby’, ‘Houston’, ‘Texas’, and ‘77001’.

Attributes that are not divisible are called simple or atomic attributes.
For eg: attribute Age cannot be divided

Single valued
Most attributes have a single value for a particular entity
For eg: Age is a single-valued attribute of a person

Multivalued
An entity having multiple values for that attribute
For eg: color of a color color={black ,red},Person’s degree degree={BE, MTech, PhD}

Stored and Derived attribute


 Two (or more) attribute values are related—for eg: the Age and Birthdate attributes of a person
 The value of Age can be determined from the current (today’s) date and the value of that person’s
birthdate
 The Age attribute is hence called a derived attribute
 Birth_date attribute is called a stored attribute

NULL Values
 In some cases, a particular entity may not have an applicable value for an attribute. For eg, the
Apartment number attribute of an address applies only to addresses that are in apartment buildings and
not to other types of residences, such as single-family homes College_degrees attribute applies only to
people with college degrees

Complex Attributes
 composite and multivalued attributes can be nested arbitrarily
 arbitrary nesting by grouping components of a composite attribute between parentheses ( ) and
separating the components with commas, and by displaying multivalued attributes between braces { }.
Such attributes are called complex attributes
 For example, if a person can have more than one residence and each residence can have a single address
and multiple phones, an attribute Address_phone for a person
{Address phone({phone(Area code,phone number)}Address (street address(street,number, apartment
number)citi,statezip)}

6a. Discuss the characteristics of a relation, with examples


6b. Define the terms: DDL, DML, and DCL. Give examples
Data definition language (DDL), is used by the DBA and by database designers to define both schemas.
Data manipulation language (DML) provides set of operations like retrieval, insertion, deletion, and
modification of the data
There are two main types of DMLs.
A high-level or nonprocedural DML
 can specify and retrieve many records in a single DML statement; therefore, they are called set-at-a-
time or setoriented DMLs
 declarative language
A lowlevel or procedural DML
 must be embedded in a general-purpose programming language
 to retrieve and process each record from a set of records. Low-level DMLs are also called record-at-a-
time DMLs
Whenever DML commands, whether high level or low level, are embedded in a general-purpose
programming language, that language is called the host language and the DML is called the data
sublanguage. A high-level DML used in a standalone interactive manner is called a query language.

7.Define the following, with an example


Value set, Data model, Meta data, Database, Schema, Instance, Canned transaction, cardinality
ratio, attribute, Primary key, Candidate key, database state, catalogue.
Value set:-
 Each simple attribute of an entity type is associated with a value set (or domain of values), which
specifies the set of values that may be assigned to that attribute for each individual entity
 Mathematically, an attribute A of entity set E whose value set is V can be defined as a function from E
to the power set P(V) of V: A : E → P(V)

A data model:-
—a collection of concepts that can be used to describe the structure of a database—provides the necessary
means to achieve this abstraction

Meta data:- The DBMS stores the descriptions of the schema constructs and constraints—also called the
meta-data.

Data base:-
A database is a collection of related data.
A data mean known facts that can be recorded and that have implicit meaning.

Schema:- The description of a database is called the database schema, which is specified during database
design and is not expected to change frequently.

Instance:-
The data in the database at a particular moment in time is called a database state or SNAPSHOT. It is also
called the currentset of occurrences or instances in the database.

Canned transaction:-
User main job function revolves around constantly querying and updating the database, using standard
types of queries and updates—called canned transactions—that have been carefully programmed and
tested.

Cardinality ratio:-
the maximum number of relationship instances that an entity can participate in.

attribute:- An attribute represents some property of interest that further describes an entity, such as the
employee’s name and salary

database state:-
The data in the database at a particular moment in time is called a database state or SNAPSHOT

Primary key:-

Candidate key:-

Catalogue:-

8.Define the following:


Entity and Attribute, Entity type and entity set, Strong and weak entity, recursive relationship and
identifying relationship, degree of a relationship type, role names, participation constraints.

Entity and attribute:-  An entity represents a real-world object or concept, such as an employee or a
project from the miniworld that is described in the database.

attribute:- An attribute represents some property of interest that further describes an entity, such as the
employee’s name and salary
entity type:-
 entity type defines a collection (or set) of entities that have the same attributes
 each entity type in the database is described by its name and attributes
Entity set:-
 The collection of all entities of a particular entity type in the database at any point in time is called an
entity set or entity collection.
 entity set is usually referred to using the same name as the entity type

Strong and weak entity:-


 In contrast, regular entity types that do have a key attribute—are called strong entity types
 Entity types that do not have key attributes of their own are called weak entity types

Recursevie relationship and identifying relationship:-


 same entity type participates more than once in a relationship type in different roles, such relationship
types are called recursive relationships

 We call this other entity type the identifying or owner entity type, and we call the relationship type that
relates a weak entity type to its owner the identifying relationship of the weak entity type

Degree of a relationship type:- The degree of a relationship type is the number of participating entity
types
Role name:-  the role name signifies the role that a participating entity from the entity type plays in each
relationship instances.

Participation constraints:-
 The participation constraint specifies whether the existence of an entity depends on its being related to
another entity via the relationship type
 There are two types of participation constraints—total and partial

9.Write ER diagram for company database with at least 4 entities


10a. What are the Structural constraints on Relationship type? Explain with example
Refer same 9 answer for example
10b. short note on Specialisation and Generalisation with eg
 Specializationis the process of defining a set of subclasses of an entity type; this entity type is called
the superclass of the specialization.
 The set of subclasses that forms a specialization is defined on the basis of some distinguishing
characteristic of the entities in the superclass.
 For example, the set of subclasses {SECRETARY, ENGINEER, TECHNICIAN} is a specialization of
the superclass EMPLOYEE that distinguishes among employee entities based on the job type of each
employ
DBMS Interfaces
 Menu-Based Interfaces for Web Clients or Browsing. These interfaces present the user with lists of
options (called menus) that lead the user through the formulation of a request.
 Forms-Based Interfaces displays a form to each user. Users can fill out all of the form entries to insert
new data, or they can fill out only certain entries, in which case the DBMS will retrieve matching data for
the remaining entries
 Graphical User Interfaces displays a schema to the user in diagrammatic form. The user then can
specify a query by manipulating the diagram. GUIs utilize both menus and forms. Most GUIs use a
pointing device.
 Natural Language Interfaces accepts requests written in English or some other language and attempt
to understand them.
 Speech Input and Output use of speech as an input query and speech as an answer to a question or
result.The speech input is detected using a library of predefined words and used to set up the parameters
that are supplied to the queries.
 Interfaces for Parametric Users such as bank tellers, often have a small set of operations that they
must perform repeatedly.
 Interfaces for the DBA. DBA use privileged commands. These include commands for creating
accounts, setting system parameters, granting account authorization, changing a schema, and reorganizing
the storage structures of a database.

You might also like