0% found this document useful (0 votes)
15 views15 pages

DBMS QB Ans

The document explains various concepts related to databases and database management systems (DBMS), including definitions of databases and DBMS, advantages of DBMS, and types of data models. It covers topics such as data abstraction, data independence, integrity constraints, and operations in relational algebra, along with examples and diagrams. Additionally, it discusses the structure of DBMS, the ER model, attributes, and different types of keys in a relational database.

Uploaded by

avishyam.tentu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views15 pages

DBMS QB Ans

The document explains various concepts related to databases and database management systems (DBMS), including definitions of databases and DBMS, advantages of DBMS, and types of data models. It covers topics such as data abstraction, data independence, integrity constraints, and operations in relational algebra, along with examples and diagrams. Additionally, it discusses the structure of DBMS, the ER model, attributes, and different types of keys in a relational database.

Uploaded by

avishyam.tentu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Short Answers

1 Relate the terms Database and Database management Systems.

A database is a collection of data, typically describing the activities of one or more related
organizations.

A database management system, or DBMS, is software designed to assist in maintaining and utilizing
large collections of data.

2 List the advantages of DBMS.

Data Independence: In a database system, the database management system provides the interface
between the application programs and the data.

Improved Data Sharing: DBMS allows a user to share the data in any number of application
programs.

Security: Having complete authority over the operational data, enables the DBA in ensuring that the
only mean of access to the database is through proper channels.

Efficient Data Access: In a database system, the data is managed by the DBMS and all access to the
data is through the DBMS providing a key to effective data processing.

3 Define instances and Schemas of database.

Databases change over time as information is inserted and deleted. The collection of information
stored in the database at a particular moment is called an instance of the database.

The overall design of the database is called the database schema.

4 Give an example for total participation and partial participation.

Double line between entity set “Student” and relationship set “Enrolled In” signifies total
participation. It specifies that each student must be enrolled in at least one course. Single line
between the entity set “course” and relationship set “enrolled In” signifies partial participation. It
specifies that there might exists some courses for which no enrolments have been made.

5 How to represent the strong Entity set and Weak entity set in ER-Model?

Strong Entity is represented by a single rectangle:

Weak Entity is represented by double rectangle:


6 Draw the diagram for levels of abstraction and explain.

• Physical level (or Internal View / Schema): The lowest level of abstraction describes how the data
are actually stored. The physical level describes complex low-level data structures. It explains various
types of stored records, what indexes exist, and so on.

• Logical level (or Conceptual View / Schema): The next-higher level of abstraction describes what
data are stored in the database, and what relationships exist among those data. This level of
abstraction is used by Database Administrator (DBA).

• View level (or External View / Schema): The highest level of abstraction describes only part of the
database which are requested by the user, but not the entire database. The view level of abstraction
exists to simplify their interaction with the system

7 List the integrity constraints in relational model. \

There are many types of integrity constraints.

1. Entity Integrity Constraint/Key constraints

2. Referential Integrity constraints/ Foreign key


3. Domain constraints

4. General constraints

8 Give examples of selection and projection operations in relational algebra.

Selection (σ): Selection operator is used to select tuples from a relation based on some condition. A
new relation is created by selecting only those rows requested by the user satisfying a specified
condition.

Syntax: σ (Cond)(Relation Name)

E.g: σ (AGE>18)(STUDENT)

Projection (π): The projection eliminates all attributes of the input relation but those mentioned in
the projection list. That means all other unnecessary fields are projected out.

Syntax: ∏(Column 1,Column 2….Column n)(Relation Name)

E.g: Extract ROLL_NO and NAME from STUDENT relation ∏(ROLL_NO,NAME)(STUDENT)

9 What is Querying relational data? Justify with one example.

A relational database query as a question about the and the answer consisting of a new relation
containing the result.

10 Illustrate division Operation in relational algebra.

Division is typically required when you want to find out entities that are interacting with all entities of
a set of different type entities. The division operator is used when we have to evaluate queries which
contain the keyword ‘all’.

Given two relations(tables): R(x,y) , S(y).

where R and S are

tables x and y : column of R

y : column of S R(x,y) div S(y) means gives all distinct values of x from R that are associated
with all values of y in S.

11 Write short notes on altering tables and views.

ALTER TABLE : ALTER TABLE modifies the structure of an existing table. To add a column called
maiden-name to Students, for example, we would use the following command:

Syntax: ALTER TABLE Students ADD COLUMN maiden-name CHAR(10) ;

12 Explain Domain Relational Calculus.


In contrast to tuple relational calculus, domain relational calculus uses list of attribute to be selected
from the relation based on the condition. It is same as TRC, but differs by selecting the attributes
rather than selecting whole tuples. It is denoted as below:

{< a1, a2, a3, … an > | P(a1, a2, a3, … an)} Where a1, a2, a3, … an are attributes of the relation and P
is the condition. Here each attribute is given a variable name

13 Give examples for UNION, INTERSECT and EXCEPT Clauses.

14 Define Aggregate Operators.

15 Demonstrate how to add a NOT NULL Column to a Table.

LONG ANSWERS
1 Compare and Contrast File Systems with Database Systems.
2 Discuss about different types of Data Models.

DATA MODELS: A Database model defines the logical design and structure of a database and defines
how data will be stored, accessed and updated in a database management system.

 Relational model: The most common model, the relational model sorts data into tables, also known
as relations, each of which consists of columns and rows. Each column lists an attribute of the entity.

 Hierarchical Model: This model organizes data into a tree-like-structure, with a single root, to which
all the other data is linked. The hierarchy starts from the Root data, and expands like a tree, adding
child nodes to the parent nodes.

 Network Model: This is an extension of the Hierarchical model. In this model data is organized in
the form of graph, and are allowed to have more than one parent node. In this database model data
is more related as more relationships are established in this database model. Also, as the data is
more related, hence accessing the data is also easier and fast.

 Entity-Relationship Model: Entity-Relationship (ER) Model is based on the notion of real-world


entities and relationships among them. ER Model is based on

 Entities and their attributes.

 Relationships among entities

 Entity − An entity in an ER Model is a real-world entity having properties called attributes.


Every attribute is defined by its set of values called domain. For example, in a school
database, a student is considered as an entity. Student has various attributes like name, age,
id etc.

 Relationship – The logical association among entities is called relationship.

3 Write about various database system applications in detail

APPLICATIONS:

Sales: For customer, product, and purchase information.

◦ Accounting: For payments, receipts, account balances, assets and other accounting information.

◦ Human resources: For information about employees, salaries, payroll taxes, and benefits, and for
generation of pay checks.

◦ Manufacturing: For management of the supply chain and for tracking production of items in
factories, inventories of items in ware houses and stores, and orders for items. Online retailers: For
sales data noted above plus online order tracking, generation of recommendation lists, and
maintenance of online product evaluations.

◦ Banking: For customer information, accounts, loans, and banking transactions.

◦ Credit card transactions: For purchases on credit cards and generation of monthly statements.

◦ Finance: For storing information about holdings, sales, and purchases of financial instruments such
as stocks and bonds; also, for storing real-time market data to enable online trading by customers
and automated trading by the firm.

• Universities: For student information, course registrations, and grades (in addition to standard
enterprise information such as human resources and accounting).

• Airlines: For reservations and schedule information. Airlines were among the first to use databases
in a geographically distributed manner.

• Telecommunication: For keeping records of calls made, generating monthly bills, maintaining
balances on prepaid calling cards, and storing information about the communication networks.

4 Draw and explain Data Abstraction and Data Independence in detail.

DATA ABSTRACTION:

 Data abstraction is the process of hiding unwanted and irrelevant details from the end
user.

 It helps to store information in such a way that the end user can access data which is
necessary, the user will not be able to see what data is stored or how it is stored in a
database.

 Data abstraction helps to keep data secure from unauthorized access and it hides all the
implementation details.

Levels of Abstraction:

 There are three levels of data abstraction in DBMS that are mentioned below:

a) Physical or Internal Level:

 It is the lowest level of data abstraction which defines how data is stored in database.

 It defines data structures used to store data and methods to access data in database.

 It is very complex to understand and hence kept hidden from user.

 The internal view is described by internal schema.

b) Logical or Conceptual Level:

 It is intermediate level present next to physical level.

 It defines what data is present in database and their relationships between them .

 It is less complex as compared to physical level.


 Programmers generally work at this level and depending on data, structure of tables,
relationships and their constraints is decided at this level.

 Conceptual view is defined by conceptual schema.

c)View or External Level:

 It is the highest level in abstraction.

 There are different levels of views and each view defines only a part of whole data
required to user.

 This level defines many views of same database for simplification of view to user.

 This is the highest level and easiest to understand for user.

 External view is describes by external schema.

DATA INDEPENDENCE:

 Data Independence is the ability to change the schema at one level of a database system
without affecting the schema at the next higher level.

 It is important because it allows changes in the data structure without disrupting application
programs or the way users interact with the data.

Types of Data Independence:

 Physical Data Independence:

 The ability to change the physical storage of data (how data is stored) without affecting the
logical schema (what data is stored and its relationships).
 It allows changes in the hardware or file organization without impacting application
programs or user views.

 Logical Data Independence:

 The ability to change the logical schema (the structure of data and relationships) without
affecting the external schema or application programs.

 It provides flexibility in modifying the database structure, such as adding new fields or
changing relationships, without disturbing the user interface or applications.

5 Describe the Structure of DBMS.


Query Processor: It takes commands from the users, evaluates plans, executes these plans and
returns the answer.

 DML Pre-compiler: It translates DML statements in a query language into low level instructions that
query evaluation engine understands. It also attempts to transform user's request into an equivalent
but more efficient form.

 Embedded DML Pre-compiler: It converts DML statements embedded in an application program


to normal procedure calls in the host language. The Pre-compiler must interact with the DML
compiler to generate the appropriate code.

 DDL Interpreter: It interprets the DDL statements and records them in a set of tables containing
meta data or data dictionary.

 Query Evaluation Engine: It executes low-level instructions generated by the DML compiler.

 Application program object code: These are the low-level instructions of the programs written by
the users, which query evaluation engine understands and execute them.

Storage Manager:
A storage manager is a program module that provides the interface between the low-level data
stored in the database and the application programs and queries submitted to the system. The
storage manager is responsible for the interaction with the file manager. The storage manager
components include:

 Authorization and integrity manager, which tests for the satisfaction of integrity constraints and
checks the authority of users to access data.

 Transaction manager, which ensures that the database remains in a consistent (correct) state
despite system failures, and that concurrent transaction executions proceed without conflicting.

 File manager, which manages the allocation of space on disk storage and the data structures used
to represent information stored on disk.

 Buffer manager, which is responsible for fetching data from disk storage into main memory, and
deciding what data to cache in main memory. The buffer manager is a critical part of the database
system, since it enables the database to handle data sizes that are much larger than the size of main
memory.

 Lock Manager: Keep tracks of request for locks and grant locks on data.

 Recovery manager: Responsible for maintaining a log and restoring system to consistent state after
a crash.

Following data structures are required as a part of the physical system implementation.

• Data Files: It stores the database.

• Data Dictionary: It stores meta data (data about data) about the structure of the database.

• Indices: Provide fast access to data items that hold particular values.
• Statistical Data: It stores statistical information about the data in the database. This information is
used by query processor to select efficient ways to execute query.

6 What is ER model? Explain the basic symbols used for entities, attributes and relationships.

ER Diagram

The ER or (Entity Relational Model) is a high-level conceptual data model diagram. Entity- Relation
model is based on the notion of real-world entities and the relationship between them. ER modeling
helps you to analyze data requirements systematically to produce a well-designed database.

ER- Diagram Notations

ER- Diagram is a visual representation of data that describe how data is related to each other.

 Rectangles: This symbol represent entity types

 Ellipses: Symbol represent attributes

 Diamonds: This symbol represents relationship types

 Lines: It links attributes to entity types and entity types with other relationship types

 Primary key: attributes are underlined

 Double Ellipses: Represent multi-valued attributes

7 What is an attribute? Explain various types of attributes with examples.

Attribute(s)

Entities are represented by means of their properties, called attributes. For example, Roll_No, Name,
DOB, Age, Address, Mobile No are the attributes of Student. In ER diagram, attribute is represented
by an oval.

1. Key Attribute: The attribute which uniquely identifies each entity in the entity set is called key
attribute. For example, Roll No will be unique for each student. In ER diagram, key attribute is
represented by an oval with underlying lines.
2. Composite Attribute: An attribute that can be divided into smaller independent attribute is known
as composite attribute. For example, Address attribute of student Entity type consists of Street, City,
State, and Country. In ER diagram, composite attribute is represented by an oval comprising of ovals.

3. Single Valued Attribute: An attribute that has only single value for an entity is known as single
valued attribute.

4. Multivalued Attribute: An attribute that can have multiple values for an entity is known as multi
valued attribute. For example, Phone_No (can be more than one for a given student). In ER diagram,
multivalued attribute is represented by double oval.

5. Derived Attribute An attribute which can be derived from other attributes is known as derived
attribute. e.g.; Age (can be derived from DOB). In ER diagram, derived attribute is represented by
dashed oval.

6. Null-Valued-Attribute An attribute, which has not any value for an entity is known as null valued
attribute. For example, assume Student is an entity and its attributes are Name, Age, Address and
Phone no. There may be chance when a student has no phone no. In that case, phone no is called
null valued attributes.

8 What is Key? Distinguish between Super key, Candidate key, Primary Key, Foreign Key for a relation
with examples.

Keys in a Database

In a relational database, a key is an attribute or a set of attributes that uniquely identifies a tuple
(row) in a relation (table). Keys are crucial in ensuring data integrity and avoiding duplication.

Types of Keys

1. Super Key

o A super key is a set of one or more attributes that can uniquely identify a tuple in a
relation.

o It may contain unnecessary attributes.


o Example: Consider a table Student

Student_ID Name Email Phone

101 John [email protected] 9876543210

102 Emma [email protected] 9876543221

103 Alex [email protected] 9876543232

o Possible super keys:

 {Student_ID}

 {Student_ID, Email}

 {Student_ID, Phone}

2. Candidate Key

o A candidate key is a minimal super key (i.e., it has no unnecessary attributes).

o A table can have multiple candidate keys.

o Example: From the Student table, possible candidate keys are:

 {Student_ID}

 {Email}

3. Primary Key

o A primary key is a candidate key that is chosen to uniquely identify tuples in a


relation.

o It must be unique and not null.

o Example: In the Student table, we can choose Student_ID as the primary key.

4. Foreign Key

o A foreign key is an attribute (or a set of attributes) in one table that references the
primary key of another table.

o It establishes a relationship between two tables.

o Example: Consider another table Course_Enrollment

Enrollment_ID Student_ID Course

201 101 Math

202 102 Science

 Here, Student_ID in Course_Enrollment is a foreign key referencing


Student_ID in the Student table.
9 How to represent generalization, specialization and aggregation using ER Diagrams. Explain with
suitable example.

10 Develop an E -R Diagram for Banking enterprise system

11 Illustrate about integrity constraints with suitable examples

12 How to alter, destroy tables and views? Give example queries

13 Explain Views and its merits & demerits.

14 Elaborate on logical database design with examples.

15 Explain the fundamental operations in relational algebra with examples

16 Explain Tuple relational calculus.

17 Discuss briefly about Domain relational calculus with suitable example.

18 Explain Enforcing integrity Constraints over a Relation.

19 Let R =(ABC) and S=(DEF) let r(R) and s(S) be relations on schema R and S. Give an expression in
the Domain relational calculus that is equivalent to each of the following. i) σB=25(r) ii) ∏A,F,
( σC=D(rXs))

20 Consider the following relations Sailors (sid, sname, rating, age) Boats (bid, bname, color)
Reserves (sid, bid, day) Write the statements in Relational Algebra, Relational Calculus, Domain
Relational Calculus and SQL for the following questions. a) Find the names of sailors who have
reserved a Red boat. b) Find the names of sailors who have reserved at least one boat. c) Find the
names of sailors who have reserved a Red and a Green boat. d) Find the names of sailors who have
reserved a Red or a White boat. e) Find the names of sailors who have reserved all boats
21 Consider the following relational schema. Student (id, name, age, city) Retrieve the names of all
students. Display the id’s of all students who are having age above 20. Display the names and id’s of
all students who are having age between 20 and 25 and lives in Hyderabad city.

22 Discuss about Complex integrity constraints in SQL.

23 Define trigger and explain its three parts? Differentiate row level and statement level triggers

24 Elaborate on Nested Queries and Correlated nested queries in SQL.

You might also like