clickhere - Hitmatter.com

advertisement
1|Page
Q:- What is DBMS? Explain its goals, purpose and application areas. Also write advantages of DBMS over file shearing.
A:- The term data can be defined as a set of isolated and unrelated ram facts with an implicit meaning.
When the data is processed and converted into a meaningful and useful form,it is known as information.
A database is a collection of logically related data arranged in a structured form designed to meet the
information requirements of multiple users.It may also be defined as the collection of non-redundant operational data
sharable between different application systems.
A database Management System (DBMS) is a convenient and effective method of defining, storing, retrieving and
manipulating the data contained in the database from unauthorized access and recovery of data during system failures.
The goals of DBMS:I.
II.
III.
To provide retrieval flexibility. It should be relatively easy to link data from different files.
To facilitate reduction of data duplication and elimination of multiple copies of a master file. Data redundancy
control helps in overcoming updating problems and promotes data integrity.
To ensure high level of data independence .The data is hidden from the programming language, operating
system and processing environment. It should be up to DBMS to convert the stored data into a form that could
be used in whatever language the programmers desire to use.
Purpose of DBMS:Database Management Systems were developed to handle the following difficulties of typical file processing systems
supported by conventional operating systems.






Data redundancy and inconsistency.
Difficulty in accessing data.
Data isolation-multiple file formats.
Atomicity of updates.
Security problems.
Convergent access by multiple users.
Areas of application:Database systems are widely used in different areas because of their numerous advantages. Some of most common
database applications are:






Airlines and Railways.
Banking.
Education.
Telecommunication.
Credit and Transactions.
E-commerce.
Health and information system & electronic patiet record.
HITMATTER.COM
2|Page




Digital libraries and digital publishing.
Finance.
Sales.
Human resources.
Advantages of DBMS over file sharing:The main advantages of DBMS arecentralized data management. Several other advantages are:






Controlled data redundancy:- During database design, various files are integrated and each logical data item
is stored at central location. This eliminates replicating the data item in different files, ensures consistency
and saves the storae space.
In database approach, enforcing data integrity is much easier, various integrity constraints are identified by
database designer during database design.
Data sharing:- The data stored in the database can be shared among multiple user or application programs.
Moreover new applications can be developed to use the same stored data.
Ease of application development:- The application programmer needs to develop the application programs
according to the users needs. The other issues like concurrent access, security, data integrity etc. are
handled by the DBMS.
Data security:- Since the data is stored centrally, enforcing security constraints is much easier. The DBMS
ensures that the only means of access to the database is through an authorized channel.
Multiple user interface:- In order to meet the needs of various users having different technical knowledge,
DBMS provides different types of interface such as query languages, application program interfaces and
graphical user interface(GUI), that includes forms-style and menu –driven interfaces.
Backup and recovery:-The DBMS provides backup and the recovery subsystem that is responsible for
recovery from hardware and software failures.
HITMATTER.COM
3|Page
Fig. shows the three Levels of abstraction
Q:- what do you mean by data abstraction? What are the different levels of abstraction also need for abstraction?
A:- For the system to be usable, it must retrieve data efficiently. The need for efficiency has led designers to use complex
data structures to represent data in the database. Since many database system users are not computer trained,
developers hide the complexity from users through several layers/levels of abstraction to simplify users interaction with
the system.



Physical level:-The lowest level of abstraction describes how the data’s are actually stored. The physical level
describes complex low-level data structures in detail.
Logical level:- The next higher level of abstraction describes what data are stored in the database and what
relations exist among those data. The logical level thus describes the entire database in terms if a small number
of relatively simple structures. Although implementation of the simple structures at the logical level may involve
complex physical level structures. The user of the logical level does not need to be aware of this complexity.
Database administrators who must decide what information to keep in the database use logical level of
abstraction.
View level:- The highest level of abstraction describes only part of the entire database. Even though the logical
level uses simpler structures, complexity remains because of the variety of information. Database systems do
not need all this information; instead they need only to access only a part of the database.
HITMATTER.COM
4|Page
Q. what is DB language? Explain DDL and DML with example.
Ans. To provide the various facilities to different type of users, a DBMS normally provides one or more specialized
programming language called Database (or DBMS) languages.
The DBMS mainly provides two database languages.
Data Defination Language:




In DBMS’s where no strict separation between the levels of the database is maintained, the data definition
language is used to define the conceptual and internal schemas for the database.
The DDL statements are also used to specify the integrity rules (constraints) in order to maintain the integrity of
the database .The various integrity constraints are domain constraints, referential integrity, assertion and
authorization.
Like in any other programming language, DDL also accepts input in the form of instructions (statements) and
generates the description of schema as output.
The output is placed in the data dictionary which is a special type of table containing metadata. The DBMS refers
the data dictionary before reading or modifying the data.
Eg. IN SQL, the command such as Create, Alter, Drop and Truncate are DDL commands
CREATE: Creates Table in the database.
ALTER: Alters table / objects of the database.
DROP: Deletes objects / Tables of the database.
TRUNCATE: Deletes all records from a table and resets table identity to initial values.


Once the database schemas are defined and initial data is loaded into the database, perform other operations,
DBMS provides Data Manipulation Language (DML) that enables user to retrieve and manipulate the data.
The statement which is used to retrieve the information is called a query the part of DML used to retrieve the
information is called a query language.
 The DML are of two types
1. Non-procedural or high-level or declarative DML allows specifying the complex database operations
concisely.
i. It requires a user to specify what data is required without specify what data is retrieve
the required data. Eg. SQL.
2. The procedural or low-level DML requires user to specify what data is required and how to access the
data by providing step-by-step procedure. Eg. Relational algebra.
In addition to DDL and DML, DBMS also provides two more languages, namely, data control language (DCL) and
transaction control language (TCL).

DCL is used to create user roles, grant permissions and control access to database by securing it.
Example:
HITMATTER.COM
5|Page
GRANT: Gives user’s access privileges to database.
REVOKE: Withdraws user’s access privileges to database given with the grant command.

TCL is used to manage different transactions occuring within a database.
Example:
COMMIT: Saves work done in transactions.
ROLLBACK: Restores database to original state since the last commit command to transactions.
SAVE TRANSACTION: Set a save point within a transaction.
Q. Who are the different DB users? Explain the role of DBA.
Ans. Database users are those who interact with the databases in order to query and update database and generate
reports. Database users are classified as:
1. Naïve users: The users who query and update the database by invoking already written application
programs. The naïve users interact with the database using the interface.
2. Sophisticated users: The users such as business analyst, scientist etc. who are familiar with the facilities
provided by the DBMS, interact with the system without writing any applications programs. Such users use
database query language to retrieve information from the database to meet their complicated requirement.
3. Specialized users: The users who writes specialized database programs, which are different from traditional
data processing application. Specialized users write applications such as computer aided design systems,
knowledge-base and expert systems that store data having complex data types.
4. System analyst: Determines the requirements of the database users ( especially naïve users) to create a
solution for their business need, and focus on non-technical and technical aspects .The nontechnical aspects
involve defining system requirements , facilitating interaction between business users and technical staff
etc. Technical aspects involve developing the specification for user interface (application programs )
5. Application Programmers: These are the computer professionals who implement the specifications given by
the system analysts, and develop application programs. These programs are to facilitate easy data access
for the database users.
Database Administration (DBA)
It is a person who has central control over both data and application programs. The responsibilities of DBA vary
depending upon the job description and corporate and organization policies. Some of the responsibilities of DBA are
given here.


Schema definition and modification:
It is the responsibility of the DBA to create the database schema by executing a set of data definition statements
in DDL. The DBA also carriers out the changes to the schema according to the changing needs of the
organization.
New software installation :
HITMATTER.COM
6|Page





It is the responsibility of the DBA to install new DBMS software, application software and other related software
. After installation the DBA must test the new software.
Security enforcement and administration :
DBA is responsible for establishing and monitoring the security of the database system. It involves adding or
removing users, auditing and checking for security problems.
Data analysis :
DBA is responsible for analyzing the data stored in the database and studying its performance and efficiency in
order to effectively use indexes, parallel query execution.
Preliminary database design :
The DBA works along with the development team during the database design stage due to which many potential
problems that can arise later many potential problems that can arise later can be avoided.
Physical organization modification:
The DBA is responsible for carrying out the modification in the physical organization of the database.
Routine maintenance check :
The DBA is responsible for taking the database backup periodically in order to record from any hardware or
software failure.
Q:-What are the different types of data models? Explain each with example.
A:- A database model or simply a data model is an abstract model that describes how data is represented and used. A
data model consists of a set of data structures and conceptual tools that is used to describe the structure of a database.
Some of the data models are:
Hierarchical data model:



The hierarchical data model is the oldest type of data model developed by IBM in 1968.
This data model organizes the data in a tree like structure, in which each child node can have only one parent
node.
The database based on the hierarchical data model comprises a set of records connected to one another
through links.
The top of the tree structure consists of a single node that does not have any parent is called the root node.
HITMATTER.COM
7|Page
Network data model:




The first specification of network data model was presented by conference on data systems
------in 1996,
followed by the second -------in 1971.
The link in the network data model represents an association between precisely two records.
All the nodes are linked to each other without any hierarchy.
Many advantage of network data model is that a parent can have many child nodes and achild can also have
many parent nodes.
Since there are no restrictions on number of relationships, the database design can become complex.
HITMATTER.COM
8|Page
Relational data model:



The relational data model was developed by E.F.CODD in 1970.
There are no physical links, all data is maintained in the form of tables generally known as relation consisting of
rows and columns.
The relationships between two tables are implemented through a common attribute in the table and not by
physical links or pointers.
Querying is much easier in a relational database system eg: Oracle, Sybase, DB2, My-SQL etc.
Book
SBN
001-354-921-1
001-987-760-9
Book_title
Ransack
C++
Category
Novel
Textbook
Price
22
25
Page-count
200
800
P_id
P001
P001
Publisher
P_id
P001
Pname
Hills publication
Address
12. Park street
atlanta
State
Georgia
Phone
7134019
HITMATTER.COM
9|Page
REVIEW
R_id
A002
A006
A008
ISBN
001-987-760-9
001-354-921-1
001-987-760-9
Rating
6.0
7.5
7.2
 Object based data model :
In recent years, the object oriented paradigm has been applied to database technology ,creating two new data
models known as:
 Object oriented data model : It extends the concept of object oriented programming language with
persistence , visioning , concurrency control, data recovery , security and other database
capabilities.
 Object relational data model: it is an extension of relational data model. It combines the features of
both the relational data model and object oriented data model.
 Entity relationship model: The entity-relationship ( E-R ) data model perceives the world as consisting of basic
objects, called entities , and relationship among them these objects.
Basic concepts:
1. Entity Sets: An entity is a “ thing ” or ” object ” in the real world that is a distinguishable from all
other objects . For eg. An employee . An entity set is a set of entities of the same type that share
the same properties or attributes. For eg. Set of customers.
2. Attributes: Attributes are those properties passed by each member of an entity set.
Attributes can be further classified as: Simple and Composite: Simple cannot be divided into subparts while composite on the
other hand can be divided into subparts.
For eg. Simple:-loan number, composite:-name.
 Single- valued and Multivalued: Single valued can have one unique value for the
attribute while multivalued may have more than one value.
For eg. Single: - ID, Multi:-Phone
 Derived: The value for this type of attributes can be derived from the values of other
related attributes or entities.
 Null attributes: An attributes which has no value.
 Relationship Set: A relationship is associated among several entities .A relationship is a set of relationships of the
same type.
Constraints:
 Mapping cardinalities: Mapping cardinalities or cardinality ratios express the number
of entities to which can be associated via a relationship set.
HITMATTER.COM
10 | P a g e
Cardinalities :1> One to One:-An entity in A is associated with almost one entity in set B, and entity in set B is associated
with almost one entity in set A.
2> One to Many:- An entity in set A is associated with any number of entity in set B. An entity in B ,
however can be associated with atmost one entity in A.
HITMATTER.COM
11 | P a g e
3> Many to One :- An entity in A is associated with atmost one entity in B. An entity in B, however can be
associated with any number of entities in A.
4> Many to Many:- An entity in A is associated with any number of entities in B and an entity in B is also
associated with any number of entities in A.

Participation Constraints:- The participation of an entity set in relation R is said to be :
I >Total: If every entity in E participates in atleast one relations hip R.
HITMATTER.COM
12 | P a g e
II >Partial: If only some entities in E participating in relation R.

Keys: A key allows us to identify a set of attributes suffice to distinguish entities from each other.
1>Super Key: It is a set of one or many attributes that ,collectively allow us to identify uniquely an
entity in the entity set.
HITMATTER.COM
13 | P a g e


2>Candidate Key : They are the Super key for which no proper subset is a super key.
3>Primary Key: They denotes a candidate key that is chosen by the database designer as the principal
means of identifying entities within an entity set.
Entity-Relationship Diagram:- Following are the representations that are used in this .
1>Rectangle – Entity set.
2>Eclipse- Attribute.
3>Diamonds- Relationship set.
4>Lines- Links attributes to entity sets and entity sets to relationships.
5>Double Eclipse- Multi values attributes.
6>Dashed Eclipse- Derived attributes.
7>Double lines-Total participation.
8>Double Rectangles-Weak entity set.
Weak Entity Set:-An entity set may not have sufficient attributes to form a primary key. Such an entity
is known as weak entity. In ER diagram, it is represented by doubly outlined box.
HITMATTER.COM
14 | P a g e
HITMATTER.COM
15 | P a g e
HITMATTER.COM
16 | P a g e

Explanation of DBM structure:HITMATTER.COM
17 | P a g e
 Even a user issues a query, the parsed query is passed to a query optimizer. Which uses
information about how the data is stored to produce an efficient execution plan for evaluating
the query .
HITMATTER.COM
18 | P a g e
 An execution plan is a blueprint for evaluating a query and is usually represented as a tree of
relational operators. Relational operators serve as the building block for evaluating queries
posed against the data.
 The code that implements relational operators sits on the top of the file and access methods
layer. This layer typically supports a heap file, or file of unordered pages, as well as indexes. This
layer also organizes the information within a page.
 The file and access methods layer code sits on the top of the buffer manager, which brings
pages in from disk to main memory as needed in response to read requests.
 The lowest layer of the DBMS software deals with the management of space on disk, Where the
data is stored. Higher layers allocate , deallocate , read and write pages through this layer called
the disk space manager.
 The DBMS supports concurrently and crash recovery by carefully scheduling user request and
maintaining a log of all changes to the database. DBMS components associated with
concurrently control and recovery include the transaction manager, which ensures that
transaction request and release lock according to a suitable locking protocol and schedules the
execution transactions; the lock manager, which keeps track of request for locks and grants
locks on database objects when they become available; and the recovery manager , which is
responsible for maintaining a log and restoring the system to a consistent state after a crash.
Q. Explain the Features of E-R diagram:
Ans. Although the basic ER concepts can model most features, some aspects of a database maybe
more appropriately expressed by certain extensions. They are: Specialization- The process of designating sub groupings within an entity set is called
Specialization. A subset of entities within an entity set may have attributes that are not shared
by all the entities in the entity set. Specialization is a means for representing these distinctive
entity groupings.
In terms of ER diagram, specialization is depicted by a triangle component labeled ISA, which
stands for “is a”. For example , that a customer “is a” person . The ISA relationship may also be
referred as a superclass -subclass relationship.
This is a top-down approach.
HITMATTER.COM
19 | P a g e
 Generalization:- The design process also proceed in a bottom to top manner ,in which multiple
entity sets are synthesized into higher level entity sets on the basis of common features. This
commonality can be expressed as Generalization.
 Attribute Inheritance:- A crucial property of the higher and lower level entities created by
Specialization and Generalization is attribute inheritance. The attributes of the higher level
entity set are said to be inherited by the lower level entity sets.
 Aggregation:- One limitation of the ER model is that it can’t express relationship among
relationships. The best way to model such a situation is using aggregation. Aggregation is an
abstraction through which relationships are treated as higher level entities.
HITMATTER.COM
20 | P a g e
HITMATTER.COM
21 | P a g e
HITMATTER.COM
Download