0% found this document useful (0 votes)
8 views7 pages

DBMS ASSIGNMENT - 25. Model Solution of Assignment I

The document is an assignment solution for DBMS covering advantages of DBMS over file processing systems, definitions of key terms like entity and attribute, and explanations of record-based models including hierarchical, network, and relational models. It also discusses join operations such as natural join, left outer join, right outer join, and full outer join with examples. Additionally, it includes a request for an E-R diagram for a library management system.

Uploaded by

bhavna sen
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)
8 views7 pages

DBMS ASSIGNMENT - 25. Model Solution of Assignment I

The document is an assignment solution for DBMS covering advantages of DBMS over file processing systems, definitions of key terms like entity and attribute, and explanations of record-based models including hierarchical, network, and relational models. It also discusses join operations such as natural join, left outer join, right outer join, and full outer join with examples. Additionally, it includes a request for an E-R diagram for a library management system.

Uploaded by

bhavna sen
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/ 7

Mahakal Institute of Technology, Ujjain

Department of Information Technology


Model Solution of Assignment-I

SUBJECT NAME/SUBJECT CODE : DBMS / IT405


CLASS: B. Tech. /B.E. II Year IV Semester BRANCH/SECTION: IT

Q. 1. What are the advantages of DBMS over File processing systems?

Ans 1. Advantages of DBMS over File system :

Data redundancy and inconsistency – Redundancy is the concept of repetition of data i.e. each
data may have more than a single copy. The file system cannot control redundancy of data as each
user defines and maintains the needed files for a specific application to run. There may be a
possibility that two users are maintaining same files data for different applications. Hence changes
made by one user does not reflect in files used by second users, which leads to inconsistency of
data. Whereas DBMS controls redundancy by maintaining a single repository of data that is
defined once and is accessed by many users. As there is no or less redundancy, data remains
consistent.

Data sharing – File system does not allow sharing of data or sharing is too complex. Whereas in
DBMS, data can be shared easily due to centralized system.

Data concurrency – Concurrent access to data means more than one user is accessing the same
data at the same time. Anomalies occur when changes made by one user gets lost because of
changes made by other user. File system does not provide any procedure to stop anomalies.
Whereas DBMS provides a locking system to stop anomalies to occur.

Data searching – For every search operation performed on file system, a different application
program has to be written. While DBMS provides inbuilt searching operations. User only have to
write a small query to retrieve data from database.

Data integrity – There may be cases when some constraints need to be applied on the data before
inserting it in database. The file system does not provide any procedure to check these constraints
automatically. Whereas DBMS maintains data integrity by enforcing user defined constraints on
data by itself.

Q. 2. Define the following terms

a. Entity
b. Attribute
c. Multivalued Attribute
d. Derived attribute
Ans. 2. Entity :An entity can be a real-world object, either animate or inanimate, that can be easily
identifiable. For example, in a school database, students, teachers, classes, and courses offered can be
considered as entities. All these entities have some attributes or properties that give them their identity.
An entity set is a collection of similar types of entities. An entity set may contain entities with
attribute sharing similar values. For example, a Students set may contain all the students of a school;
likewise a Teachers set may contain all the teachers of a school from all faculties. Entity sets need
not be disjoint.

Attributes
Entities are represented by means of their properties, called attributes. All attributes have values.
For example, a student entity may have name, class, and age as attributes.

There exists a domain or range of values that can be assigned to attributes. For example, a student's
name cannot be a numeric value. It has to be alphabetic. A student's age cannot be negative, etc.

Types of Attributes
 Simple attribute − Simple attributes are atomic values, which cannot be divided further. For
example, a student's phone number is an atomic value of 10 digits.

 Composite attribute − Composite attributes are made of more than one simple attribute. For
example, a student's complete name may have first_name and last_name.

 Derived attribute − Derived attributes are the attributes that do not exist in the physical
database, but their values are derived from other attributes present in the database. For example,
average_salary in a department should not be saved directly in the database, instead it can be
derived. For another example, age can be derived from data_of_birth.

 Single-value attribute − Single-value attributes contain single value. For example −


Social_Security_Number.

 Multi-value attribute − Multi-value attributes may contain more than one values. For example,
a person can have more than one phone number, email_address, etc.

Q. 3. Explain various types of record based models.

Ans.3. There are 3 types of record based data models defined so far- Hierarchical, Network and
Relational data models. Most widely used record based data model is relational data model. Other two are
not widely used.

Hierarchical Data Models

Imagine we have to create a database for a company. What are the entities involved in it? Company, its
department, its supplier, its employees, different projects of the company etc are the different entities we
need to take care of. If we observe each of the entity they have parent –child relationship. We can design
them like we do ancestral hierarchy. In our case, Company is the parent and rests of them are its children.
Department has employees and project as its children and so on. This type of data modeling is called
hierarchical data model.
In this data model, the entities are represented in a hierarchical fashion. Here we identify a parent entity,
and its child entity. Again we drill down to identify next level of child entity and so on. This model can
be imagined as folders inside a folder!

In our example above, it is diagrammatically represented as below:

It can also be imagined as root like structure. This model will have only one main root. It then branches
into sub-roots, each of which will branch again. This type of relationship is best defined for 1:N type of
relationships. E.g.; One company has multiple departments (1:N), one company has multiple suppliers
(1:N),one department has multiple employees (1:N), each department has multiple projects(1:N).

Network Data Models

This is the enhanced version of hierarchical data model. It is designed to address the drawbacks of the
hierarchical model. It helps to address M:N relationship. This data model is also represented as
hierarchical, but this model will not have single parent concept. Any child in the tree can have multiple
parents here.

Let us revisit our company example. A company has different projects and departments in the company
own those projects. Even suppliers of the company give input for the project. Here Project has multiple
parents and each department and supplier have multiple projects. This is represented as shown below.
Basically, it forms a network like structure between the entities, hence the name.

Relational Data Models

This model is designed to overcome the drawbacks of hierarchical and network models. It is designed
completely different from those two models. Those models define how they are structured in the database
physically and how they are inter-related. But in the relational model, we are least bothered about how
they are structured. It purely based on how the records in each table are related. It purely isolates physical
structure from the logical structure. Logical structure is defines records are grouped and distributed.

Let us try to understand it by an example. Let us consider department and employee from our previous
examples above. In this model we look at employee with its data. When we say an employee what all
comes into our mind? His employee id, name, address, age, salary, department that he is working etc. are
attributes of employee. That means these details about the employee forms columns in employee table
and value set of each employee for these attribute forms a row/record for an employee. Similarly,
department has its id, name.

Now, in the employee table, we have column which uniquely identifies each employee – that is employee
Id column. This column has unique value and we are able to differentiate each employee from each other
by using this column. Such column is called as primary key of the table. Similarly department table has
DEPT_ID as primary key. In the employee table, instead of storing whole information about his
department, we have DEPT_ID from department table stored. i.e.; by using the data from the department
table, we have established the relation between employee and department tables.

Observe the table structures above. They are very simple to understand. There is no redundant data as
well. It addressed major drawback of earlier data models. This type of data model is called relational data
model.This model is based on the mathematical concepts of set theory. It considers the tables as a two
dimensional table with rows and columns. It is least bothered about the physical storage of structure and
data in the memory. It considers only the data and how it can be represented in the form of rows and
columns, and the way it can establish the relation between other tables.
Q. 4. Draw an E-R diagram for library management system .Assume relevant entities and attributes for
the given system.

Q. 5. Discuss natural join , left outer join , right outer join and full outer join with example.

Ans. 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.
Natural Join (⋈)
Natural join does not use any comparison operator. It does not concatenate the way a Cartesian product
does. We can perform a Natural Join only if there is at least one common attribute that exists between
two relations. In addition, the attributes must have the same name and domain.

Natural join acts on those matching attributes where the values of attributes in both the relations are
same.

Courses

CID Course Dept

CS01 Database CS

ME01 Mechanics ME

EE01 Electronics EE
HoD

Dept Head

CS Alex

ME Maya

EE Mira

Courses ⋈ HoD

Dept CID Course Head

CS CS01 Database Alex

ME ME01 Mechanics Maya

EE EE01 Electronics Mira

Left Outer Join(R S)


All the tuples from the Left relation, R, are included in the resulting relation. If there are tuples in R
without any matching tuple in the Right relation S, then the S-attributes of the resulting relation are
made NULL.

Left

A B

100 Database

101 Mechanics

102 Electronics
Right

A B

100 Alex

102 Maya

104 Mira

Courses HoD

A B C D

100 Database 100 Alex

101 Mechanics --- ---

102 Electronics 102 Maya

Right Outer Join: ( R S)


All the tuples from the Right relation, S, are included in the resulting relation. If there are tuples in S
without any matching tuple in R, then the R-attributes of resulting relation are made NULL.

Courses HoD

A B C D

100 Database 100 Alex

102 Electronics 102 Maya

--- --- 104 Mira

Sign of Faculty

You might also like