Database Management System Qb Solution-unit i(Ai -Ml)
Database Management System Qb Solution-unit i(Ai -Ml)
8. Define redundancy.
Ans: In a Database Management System (DBMS), redundancy refers to the
unnecessary repetition or duplication of data within a database. This duplication can
lead to several issues, including increased storage costs, data inconsistency, and
higher maintenance efforts.
24. Give the notation used to represent Entity and weak entity.
Ans:
Entity:
Database Designers
Database designers are responsible for identifying the data to be stored in the database
and for choosing the appropriate structure to represent and store this data. These tasks
are usually undertaken before the database is actually implemented and populated
with data. It is the responsibility of the database designers to communicate with all
database users, in order to understand their requirements, and to come up with a
design that meets these requirements.
Ans: Data models can be categorized according to the types of concepts they use to
describe the database structure. High-level or conceptual data models provide
concepts that are close to the way many users perceive data, where as low-level or
physical data models provide concepts that describe the details of how data is stored
in the computer. Between these two extremes is a class of representational (or
implementation) data models, which provide concepts that may be understood by end-
users, hide some details of the data storage but can be implemented on a computer in
a direct way.
Conceptual data models use concepts such as entities, attributes and relationships. An
entity represents a real world object or concept, such as an employee or a project that
is described in a database. An attribute represents some property of interest that
further describes an entity, such as an employee’s name or salary. A relationship
among two or more entities represents an interaction among the entities; for example,
a works – on relationship between an employee and a project.
Representational or implementation data models are the models used most frequently
in traditional database management systems, and they include relational data model,
network and hierarchical model. Representational data models represent data by using
record structures and hence are sometimes called as record-based data models.
Physical data models describe how data is stored in the computer by representing
information such as record formats, record ordering and access paths. An access path
is a structure that makes the search for particular database records efficient.
Ans: There are many advantages and capabilities of using a good DBMS.
1. Controlling Redundancy
When multiple users share a database, it is likely that some users will not be
authorized to access all information in the database and hence only authorized
persons are allowed to access the data. In addition to this, some users may be
permitted only to retrieve data, where as others are allowed both to access,
retrieve and update. Hence the type of access operation must be controlled. and
DBMS should provide a security and authorization subsystem to specify access
restrictions to various users.
Databases can be used to provide persistent storage for program objects and data
structures so that the user of the database can store any amount of data in the
database for further use.
Because many types of users with varying levels of technical knowledge use a
database, a DBMS should provide a variety of user interfaces. These include
query languages for casual users; programming language interfaces for application
programmers; forms and command codes for parametric users; and menu-driven
interfaces and natural language interfaces for stand-alone users. Both forms – style
interfaces and menu – driven interfaces are commonly known as graphical user
interfaces (GUIs).
A database may include numerous varieties of data that are interrelated in many
ways. A DBMS must have the capability to represent variety of complex
relationships among the data as well as to retrieve and update related data easily
and efficiently.
Most database applications have certain integrity constraints that must be enforced
on the data to be stored in the table. The data that satisfies the integrity constraint
will be stored in the table for the further use, the data that fails to satisfy the
integrity constraints will be rejected to ensure consistency.
A DBMS must provide facilities for recovering from hardware and software
failures. The backup and recovery subsystem of the DBMS is responsible for
recovery.
Ans: Several criteria are normally used to classify database management systems. The
first is the data model on which the DBMS is based. The two types of data models are
the relational data model and the object data model. Many applications still run on the
database system based on hierarchical and network model. The wide use of relational
model led to a new class of DBMS known as object-relational DBMS.
We can categorize DBMSs based on the data model: relational, object, object –
relational, hierarchical, network etc. The second criterion used to classify database
management systems is the number of users supported by the system. Single-user
systems support only one user at a time and multi-user systems support multiple users
concurrently.
Third criterion is the number of sites over which the database is distributed. A DBMS
is centralized if the data is stored in a single system. A distributed DBMS (DDBMS)
can have databases distributed over many sites. We can also classify the DBMS on
the basic of types of access paths as general purpose DBMS and a special purpose
DBMS.
Ans:
▪ The internal level has an internal schema, which describes the physical storage
structure of the database. The internal schema uses a physical data model and
describes the complete details of data storage and access paths for the database.
▪ The conceptual level has a conceptual schema, which describes the structure of the
whole database for a community of users. The conceptual schema hides the details of
the physical storage structures and concentrates on describing entities, data types,
relationships, user operations and constraints. A high – level data model or an
implementation data model can be used at this level.
▪ The external or view level includes a number of external schemas or user views.
Each external schema 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. A high – level
data model or an implementation data model can be used at this level.
Ans: The concept of data independence 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. There are two types of data independence.
1. Logical Data Independence: It is the capacity to change the conceptual schema without
having to change the external schemas or application programs. We may change the
conceptual schema to expand the database (by adding records) or to reduce the database
(by removing records). Changes to constraints can be applied also to the conceptual
schema without affecting the external schemas or application programs.
2. Physical Data Independence: It is the capacity to change the internal schema without
having to change the conceptual or external schemas. Changes to the internal schema may
be needed because some physical files need to be reorganized – for example, by creating
additional access structures – to improve the performance of retrieval or update. If the
same data remains in the database, we should not have to change the conceptual schema.
Ans:Role Name
In the context of a relational data model, a role name is used to clarify the function of an
entity in a relationship, especially when the same entity type participates more than once
in a relationship. This is particularly useful in self-referencing or recursive relationships
where the same entity type is related to itself in different roles.
Recursive Relationship
In this table:
ManagerID is a foreign key that references EmployeeID within the same table.
ManagerID is used to establish the recursive relationship.
10. Explain the Relationship Type and cardinality ratio with an example.
Ans: A relationship is used to describe the relation between entities. Diamond or
rhombus is used to represent the relationship.
Cardinality ratios are used to describe the numerical relationships between entities in
an ER diagram. These ratios determine the number of instances of one entity that can
or must be associated with each instance of another entity.
Types of relationship
a. One-to-One Relationship
b. One-to-many relationship
c. Many-to-one relationship
d. Many-to-many relationship
a. One-to-One Relationship
When only one instance of an entity is associated with the relationship, then it
is known as one to one relationship.
b. One-to-many relationship
When only one instance of the entity on the left, and more than one instance of
an entity on the right associates with the relationship then this is known as a
one-to-many relationship.
For example, Scientist can invent many inventions, but the invention is done
by the only specific scientist.
c. Many-to-one relationship
When more than one instance of the entity on the left, and only one instance of
an entity on the right associates with the relationship then it is known as a
many-to-one relationship.
For example, Student enrolls for only one course, but a course can have many
students
d. Many-to-many relationship
When more than one instance of the entity on the left, and more than one
instance of an entity on the right associates with the relationship then it is
known as a many-to-many relationship.
For example, Employee can assign by many projects and project can have
many employees.
Example:
Weak entities are represented with double rectangular box in the ER Diagram and
the identifying relationships are represented with double diamond. Partial Key
attributes are represented with dotted lines.
In the above ER Diagram, ‘Loan’ is the weak entity.
DDL
DDL stands for Data Definition Language. It is used to define database structure or
pattern.It is used to create schema, tables, indexes, constraints, etc. in the
database.Using the DDL statements, you can create the skeleton of the database.Data
definition language is used to store the information of metadata like the number of
tables and schemas, their names, indexes, columns in each table, constraints, etc.
DCL
DCL stands for Data Control Language. It is used to retrieve the stored or saved
data.The DCL execution is transactional. It also has rollback parameters. Some tasks
that come under DCL:
• Grant: It is used to give user access privileges to a database.
DML
DML stands for Data Manipulation Language. It is used for accessing and
manipulating data in a database. It handles user requests.
TCL
TCL is used to run the changes made by the DML statement. TCL can be grouped
into a logical transaction. Some tasks that come under TCL:
• Rollback: It is used to restore the database to original since the last Commit
The database and DBMS catalog is usually stored on the disk. Access to disk is
controlled by the operating system, which schedules disk, input-output devices. A
high level stored data manager module of DBMS controls access to DBMS
information that is stored on the disk.
The dotted lines and the circles marked with A, B, C, D and E illustrate the accesses
under the control of the stored data manager.
The DDL compiler processes schema definitions and stores the descriptions of the
schemas (meta- data) in the system catalog. The catalog includes information such as
file names, data items, storage information etc. The run-time database processor
handles database access at runtime; it receives the retrieval or update operations and
carries them out on the database.
Access to disk goes through stored data manager. A query compiler handles high-
level queries that are placed interactively. The pre –compiler extracts DML
commands from an application program written in a host programming language.
These commands are sent to the DML compiler for compilation into objects code for
database access.
The first step shown is requirements collection and analysis. During this step, the
database designers interview prospective database users to understand and document
their data requirements.
Once all the requirements have been collected and analyzed, the next step is to create
a conceptual schema for the database, using a high-level conceptual data model. This
step is called conceptual design. The conceptual schema is concise description of the
data requirements of the users and include detailed descriptions of the entity types,
relationships and constraints; these are expressed using the concepts provided by the
high-level data model. Because these concepts do not include implementation details,
they are usually easier to understand and can be used to communicate with
nontechnical users.
The next step in database design is the actual implementation of the database, using
commercial DBMS. Most current commercial DBMSs use an implementation data
model- such as the relational or the object database model- so the conceptual schema
is transformed from the high- level data model into the implementation data model.
This step is called logical design or data model mapping, and its result is a database
schema in the implementation data model of the DBMS.
Finally, the last step is the physical design phase, during which the internal storage
structures, access path and file organizations for the database files are specified. In
parallel with these activities, application programs are designed and implanted as the
database transactions corresponding to the high-level transaction specifications.
Stored attribute:
The stored attribute are those attribute which doesn’t require any type of further
update since they are stored in the database.
Example: DOB(Date of birth) is the stored attribute.
Key attribute:
Key attributes are those attributes that can uniquely identify the entity in the entity
set.
Example: Roll-No is the key attribute because it can uniquely identify the student.
1.Entity
An Entity may be an object with a physical existence – a particular person, car, house,
or employee – or it may be an object with a conceptual existence – a company, a job,
or a university course.
2. Attributes
Attributes are the properties that define the entity type. For example, Roll_No, Name,
DOB, Age, Address, and Mobile_No are the attributes that define entity type Student.
In ER diagram, the attribute is represented by an oval.
a. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called
the key attribute. For example, Roll_No will be unique for each student. In ER
diagram, the key attribute is represented by an oval with underlying lines.
b. Composite Attribute
An attribute composed of many other attributes is called a composite
attribute. For example, the Address attribute of the student Entity type consists
of Street, City, State, and Country. In ER diagram, the composite attribute is
represented by an oval comprising of ovals.
c. Multivalued Attribute
An attribute consisting of more than one value for a given entity. For example,
Phone_No (can be more than one for a given student). In ER diagram, a
multivalued attribute is represented by a double oval.
d. Derived Attribute
An attribute that can be derived from other attributes of the entity type is
known as a derived attribute. e.g.; Age (can be derived from DOB). In ER
diagram, the derived attribute is represented by a dashed oval.
3. Relationship Type and Relationship Set
A Relationship Type represents the association between entity types. For
example, ‘Enrolled in’ is a relationship type that exists between entity type
Student and Course. In ER diagram, the relationship type is represented by a
diamond and connecting the entities with lines.
4. Weak Entity
An Entity type has a key attribute that uniquely identifies each entity in the
entity set. But some entity type exists for which key attributes can’t be defined. These
are called Weak Entity types.
A weak entity type is represented by a Double Rectangle. The participation of weak
entity types is always total. The relationship between the weak entity type and its
identifying strong entity type is called identifying relationship and it is represented by
a double diamond.