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

DBMS Assignment Answers

Answers
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
89 views14 pages

DBMS Assignment Answers

Answers
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 14

DBMS ASSIGNMENT ANSWERS

1) What is a database and database management system?


Outline the applications of database management systems.

Database :
A database is a collection of data that is organized and stored electronically. It
can store any type of data, including numbers, words, images, videos, and
files.
Database management system:
A database management system (DBMS) is a collection of interrelated and a
set of application programs used to access, update and manage that data.
The goal of DBMS is to provide an environment that is both convenient and efficient to
use in retrieving information from the database, Storing information into the database.
DATABASE SYSTEM APPLICATIONS :

• Banking: All Transactions


• Universities: Registration, Grades
• Sales: Customers, Products, Purchases
• Online Retailers: Order Tracking, Customized Recommendations
• Manufacturing: Production, Inventory, Orders, Supply Chain
• Airlines: Reservations, Schedules
• Human Resources: Employee Records, Salaries, Tax Deductions

2) Explain the database system architecture.


• Database applications are usually partitioned into two or three parts.
• In two-tier architecture, the application resides at the client machine,
where it invokes database system functionality at the server machine
through query language statements.
• Application program interface standards like ODBC and
• JDBC are used for interaction between the client and the server.
• In contrast, in three-tier architecture, client end communicates with an
application server, usually through a forms interface.
• The business logic of the application, which says what actions to carry
out under what conditions, is embedded in the application server.
• Three-tier applications are more appropriate for large applications and
for applications that run on the WWW.
3) Summarize the roles of database users and database
administrators.
Database users and administrators have distinct roles within a database
system:

Database Users:

1. Naïve Users:
a. Interact with the system via predefined applications without
understanding the database structure.
b. They typically use forms or reports to interact with the system. For
instance, a student using a web interface to register for a class.
2. Application Programmers:
a. Computer professionals who develop applications to interface with
the database. They use tools like Rapid Application Development
(RAD) tools to create user interfaces with minimal coding effort.
3. Sophisticated Users:
a. These users formulate complex database queries using query
languages or data analysis tools. Analysts exploring database
information fall into this category.
4. Specialized Users:
a. Users who develop complex, non-traditional database
applications such as systems involving CAD (computer-aided
design), graphics, or audio data.

Database Administrators (DBAs):

DBAs hold central control over data and access programs. Their primary
responsibilities include:

1. Schema Definition: Creating the initial database schema through Data


Definition Language (DDL).
2. Storage Structure and Access-Method Definition: Determining how
the database stores and accesses data.
3. Schema and Physical-Organization Modification: Updating the
schema and physical organization as organizational needs change or
performance improvements are required.
4. Granting Data Access Authorization: Managing user access by
assigning different types of authorizations to control data access.
5. Routine Maintenance:
a. Periodically backing up the database.
b. Ensuring sufficient free disk space for operations.

4) Explain various types of data models.


Data Model : a collection of conceptual tools for describing
data, data relationships, data semantics, and consistency constraints.

• Relational Model: The relational model uses a collection of tables to


represent both data and the relationships among those data. Each table
has multiple columns, and each column has a unique name.

• Tables are also known as relations. The relational model is an example


of a record-based model.

• Entity-Relationship Model: The entity-relationship (E-R) data model


uses a collection of basic objects, called entities, and relationships
among these objects.

• An entity is a “thing” or “object” in the real world that is distinguishable


from other objects.

• Object-Based Data Model: Object-oriented programming (especially in


Java, C++, or C#) has become the dominant software-development
methodology.
• This led to the development of an object-oriented data model that can
be seen as extending the E-R model.
• Semi structured Data Model: The semi structured data model permits
the specification of data where individual data items of the same type
may have different sets of attributes.

• The Extensible Markup Language (XML) is widely used to represent


semi structured data.

5) Differentiate between file processing systems and database


management systems.

6) Explain in detail about all relational algebra operations with


proper definition,syntax and examples.
1. Selection (σ)

• Definition: Selection is used to select rows that satisfy a given


predicate or condition.
• Syntax: σ_condition(relation)
• Example: If you have a relation Students and want to find all students
who are in the 'CS' department, you would use:
o σ_dept='CS'(Students)

2. Projection (π)

• Definition: Projection is used to select specific columns (attributes)


from a relation.
• Syntax: π_column1, column2, ...(relation)
• Example: To get the names and departments of all students, you can
apply:
o π_name, dept(Students)

3. Union (∪)

• Definition: The union operation combines two relations and removes


duplicate tuples.
• Syntax: relation1 ∪ relation2
• Example: If you have two relations Students_CS and Students_EE,
you can combine them with:
o Students_CS ∪ Students_EE

4. Set Difference (−)

• Definition: The set difference operation returns tuples that are in the
first relation but not in the second.
• Syntax: relation1 − relation2
• Example: To find students in Students_CS but not in Students_EE:
o Students_CS − Students_EE
5. Cartesian Product (×)

• Definition: The Cartesian product combines each tuple of the first


relation with every tuple of the second relation.
• Syntax: relation1 × relation2
• Example: Combining Students and Courses relations:
o Students × Courses

6. Rename (ρ)

• Definition: Rename is used to rename the output relation or attributes.


• Syntax: ρ_newname(relation)
• Example: Renaming Students to Enrolled_Students:
o ρ_Enrolled_Students(Students)

7. Join (⨝)

• Definition: Join combines related tuples from two relations based on a


common attribute.
• Syntax: relation1 ⨝_condition relation2
• Example: To join Students and Courses based on student ID:
o Students ⨝_Students.ID=Courses.StudentID Courses

8. Intersection (∩)

• Definition: Intersection returns the tuples that are common to both


relations.
• Syntax: relation1 ∩ relation2
• Example: To find students enrolled in both CS and EE:
o Students_CS ∩ Students_EE

7) Model an E-R diagram for designing a banking system.


8) Discuss about E-R model design issues and Extended E-R
features.
E-R Model Design Issues:

The Entity-Relationship (E-R) model faces several design challenges:

1. Entity Sets vs Attributes: A key decision is whether to model certain


data as entity sets or attributes. This depends on the real-world
semantics. A common mistake is using an entity’s primary key as
another entity's attribute instead of defining a relationship.
2. Entity Sets vs Relationship Sets: It can be unclear whether a concept
should be an entity or a relationship set. Actions between entities are
often better expressed as relationships.
3. Binary vs n-ary Relationships: Most relationships are binary, but
some require n-ary (n>2) relationships to represent more complex
interactions. Replacing n-ary relationships with multiple binary ones can
increase complexity.
4. Relationship Attributes: Descriptive attributes must be correctly
placed. In one-to-many relationships, attributes usually go on the
“many” side, and for many-to-many, they are associated with the
relationship set.

Extended E-R Features:

The basic E-R model can be extended with the following:

1. Specialization: This creates sub-entity sets for more specific types


within a general set, such as "student" and "employee" from "person."
2. Generalization: The reverse of specialization, it combines multiple
entity sets into one, such as combining "instructor" and "secretary" into
"employee."

3. Attribute Inheritance: Sub-entity sets inherit attributes from their parent


entity, ensuring consistency and reducing redundancy.
4. Aggregation: Aggregation treats relationships as higher-level entities,
useful for modeling complex scenarios like relationships between
students, instructors, and projects.

These features and issues help enhance the database model’s clarity and
efficiency.
9) Explain various processes of reducing an E-R diagram into
relational schemas.
To reduce an E-R diagram into relational schemas, we follow several steps,
which are explained in the document you provided:

1. Representation of Strong Entity Sets with Simple Attributes:

a. A strong entity set with simple attributes is represented by a


relational schema. Each entity set translates into a table, where
each attribute of the entity set becomes a column in the table.

b. The primary key of the entity set is used as the primary key of the
table.

c. Example: If there is a student entity set with attributes ID, name,


and tot_cred, the corresponding relational schema will be
student (ID, name, tot_cred). Here, ID is the primary key.

2. Representation of Strong Entity Sets with Complex Attributes:


a. If an entity set has composite attributes, each component of the
composite attribute becomes an individual attribute in the
relational schema.

b. For example, an instructor entity set with composite attributes


like address (which contains street, city, state, and
zip_code) will be flattened into individual attributes:
street_number, street_name, apt_number, city, state,
zip_code.
3. Handling Multivalued Attributes:
a. Multivalued attributes are represented by creating a new relation
schema. This new relation includes the primary key of the entity
set along with the multivalued attribute.

b. Example: If instructor has a multivalued attribute


phone_number, a new table instructor_phone (ID,
phone_number) is created where each phone number of an
instructor is stored as a separate tuple.
4. Representation of Weak Entity Sets:

a. A weak entity set does not have a primary key on its own and
depends on a strong entity set for identification.
b. The relational schema for a weak entity set includes both its own
attributes and the primary key of the strong entity set on which it
depends.
• Example: If a section is a weak entity set dependent on course, the
corresponding relation could be section (course_id, sec_id,
semester, year).

5. Representation of Relationship Sets:

• For each relationship set, a new relation is created. The relation


includes the primary keys of the participating entity sets along with any
descriptive attributes of the relationship.

• Depending on the cardinality of the relationship, different choices for


primary keys are made:
o For a binary many-to-many relationship, the primary key
consists of the union of the primary keys from both participating
entity sets.
o For a binary one-to-many relationship, the primary key is the
primary key of the entity on the "many" side of the relationship.
o For a one-to-one relationship, the primary key can be the
primary key of either entity set.

10) What is the use of Normalization and discuss the first three
normal forms with suitable examples.

Normalization is a process used in database design to reduce redundancy


and ensure data integrity by organizing data into tables based on specific
rules called normal forms.
The first three normal forms (1NF, 2NF, and 3NF) are essential in this
process:

1) First Normal Form (1NF):

• Rule: Each table must have atomic (indivisible) values, and each
column must contain only one value per row.
• Example: A table storing student data must not have a column that
stores multiple phone numbers in one cell. Instead, each phone number
should be placed in a separate row or column.

2) Second Normal Form (2NF):

• Rule: The table must meet all the criteria of 1NF, and all non-key
attributes must be fully functionally dependent on the entire primary key.
• Example: Consider a table storing course enrollments:

3) Third Normal Form (3NF):

• Rule: The table must be in 2NF, and all attributes must be directly dependent on the
primary key, with no transitive dependencies (i.e., non-key attributes must not
depend on other non-key attributes).
• Example: If a table stores student information, it should not include attributes like
Department_Name, which is dependent on Department_ID:

You might also like