DBMS Sem

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

DBMS SEM-1 REPEATED QUESTIONS

(UNIT-1)
1.Give an over view of following database languages: DML ,DDL ,DCL.

2.Distinguish strong entity set and week entity set. Draw E-R diagram
for week entity set.

3.What is the role of database administrator? Explain their


responsibilities.

4.Define schema. Explain 3 level architecture of DBMS?

5.Describe the structure of DBMS?

6.1 E-R Diagram based question.

7.Explain Hierarchical, Network and relational data models.

UNIT-2
1. Compare Super key, Candidate key and Primary Key for a relation with
examples.

2. Queries in relational algebra, tuple relational Calculus and domain relational


calculus.

3. Explain various set operations with suitable examples.

4. Discuss in brief about the Relational Calculus and its types.

5. Illustrate different set operations in Relational algebra with an example?

6. Explain the functioning of a corelated nested query.


UNIT-3
1.What is trigger? Explain how to implement triggers in SQL?

2. Explain the following Operators in SQL with examples.


1) SOME ii) IN iii) EXCEPT iv) UNION

3. What is Functional Dependency? Explain types and properties of FD's.

4. Discuss the problems caused by redundancy and the purpose of


normalization and Define normalization. Explain 1NF, 2NF, 3NF and Boyce-
Codd normal forms with examples.

5. Explain fourth and fifth normal forms with suitable examples .


6. Explain lossless join decomposition with example.

7. Describe properties of decomposition in detail with examples.

UNIT-4
1. What is transaction? Explain the ACID Properties of transactions.
2. Explain the time stamp Based protocols for concurrency control in DBMS.
3. Implementation of Lock —Based Protocols in DBMS.
4. Explain Log based recovery.
5. Explain the Need of Serial izability? Explain view and conflict Serializability.
6. How to test serializability of a schedule? Explain with an example
7. Explain ARIES algorithm.
8. Explain ACID properties of a transaction and illustrate how atomicity and durability are 5M
achieved.
9. . Explain 2PL and strict 2PL protocol in detail?
UNIT-5
1.What are the indexed data structures? Explain any one of them. Compare heap
file organization with hash file organization

2.Explain how insert and delete operations are handled in a static hash index. Give
a brief note on Indexed Sequential Access Methods.

3. Distinguish between: 1) Primary and Secondary indexing. 2) Ordered


indexing and hashing.

4. Explain in detail about B+ trees.

5. Explain ISAM.

6. Demonstrate searching a given element in B+ trees with an example.

7. Write in detail about Hash based Indexing and Tree based Indexing.

UNIT-1
1ANS) Structured Query Language(SQL) as we all know is the database
language by the use of which we can perform certain operations on the existing
database and also we can use this language to create a database. SQL uses
certain commands like Create, Drop, Insert, etc. to carry out the required tasks.

DDL or Data Definition Language actually consists of the SQL commands that
can be used to define the database schema. It simply deals with descriptions of
the database schema and is used to create and modify the structure of database
objects in the database.DDL is a set of SQL commands used to create, modify,
and delete database structures but not data. These commands are normally not
used by a general user, who should be accessing the database via an application.
List of DDL commands:
• CREATE: This command is used to create the database or its objects
(like table, index, function, views, store procedure, and triggers).
• DROP: This command is used to delete objects from the database.
• ALTER: This is used to alter the structure of the database.
• TRUNCATE: This is used to remove all records from a table, including
all spaces allocated for the records are removed.
• COMMENT: This is used to add comments to the data dictionary.
• RENAME: This is used to rename an object existing in the database.

DML(Data Manipulation Language):


The SQL commands that deals with the manipulation of data present in the
database belong to DML or Data Manipulation Language and this includes most
of the SQL statements. It is the component of the SQL statement that controls
access to data and to the database. Basically, DCL statements are grouped with
DML statements.
List of DML commands:
• INSERT : It is used to insert data into a table.
• UPDATE: It is used to update existing data within a table.
• DELETE : It is used to delete records from a database table.
• LOCK: Table control concurrency.
• CALL: Call a PL/SQL or JAVA subprogram.
• EXPLAIN PLAN: It describes the access path to data.

DCL (Data Control Language):


DCL includes commands such as GRANT and REVOKE which mainly deal with
the rights, permissions, and other controls of the database system.
List of DCL commands:
• GRANT: This command gives users access privileges to the database.
• REVOKE: This command withdraws the user’s access privileges given
by using the GRANT command.

2.ans): Strong Entity:


A strong entity is not dependent on any other entity in the schema. A strong
entity will always have a primary key. Strong entities are represented by a
single rectangle. The relationship of two strong entities is represented by a
single diamond.
Various strong entities, when combined together, create a strong entity set.
Weak Entity:
A weak entity is dependent on a strong entity to ensure its existence. Unlike a
strong entity, a weak entity does not have any primary key. It instead has a
partial discriminator key. A weak entity is represented by a double rectangle.
The relation between one strong and one weak entity is represented by a
double diamond. This relationship is also known as identifying relationship.
E-R diagram of weak entity:

3 ANS):

A database administrator's (DBA) primary job is to ensure that data is


available, protected from loss and corruption, and easily accessible as
needed. Below are some of the chief responsibilities that make up the day-
to-day work of a DBA.

1. Software installation and Maintenance.


2. Data Extraction, Transformation, and Loading.
3. Specialized Data Handling
4. Database Backup and Recovery
5. Security
6. Authentication
7. Capacity Planning
8. Performance Monitoring
9. Database Tuning
10. Troubleshooting

4 ANS): The term "schema" refers to the organization of data as a


blueprint of how the database is constructed.
The three-schema architecture is as follows:

1. Internal Level

o The internal level has an internal schema which describes the physical storage structure of the
database.

o The internal schema is also known as a physical schema.

o It uses the physical data model. It is used to define that how the data will be stored in a block.

o The physical level is used to describe complex low-level data structures in detail.

The internal level is generally is concerned with the following activities:

Skip Ad

o Storage space allocations.


For Example: B-Trees, Hashing etc.

o Access paths.
For Example: Specification of primary and secondary keys, indexes, pointers and sequencing.

o Data compression and encryption techniques.

o Optimization of internal structures.


o Representation of stored fields.

2. Conceptual Level

o The conceptual schema describes the design of a database at the conceptual level. Conceptual
level is also known as logical level.

o The conceptual schema describes the structure of the whole database.

o The conceptual level describes what data are to be stored in the database and also describes
what relationship exists among those data.

o In the conceptual level, internal details such as an implementation of the data structure are
hidden.

o Programmers and database administrators work at this level.

3. External Level

o At the external level, a database contains several schemas that sometimes called as subschema.
The subschema is used to describe the different view of the database.

o An external schema is also known as view schema.

o Each view schema describes the database part that a particular user group is interested and
hides the remaining database from that user group.

5 ANS):

Database Management System (DBMS) is a software that allows access to


data stored in a database and provides an easy and effective method of –
• Defining the information.
• Storing the information.
• Manipulating the information.
• Protecting the information from system crashes or data theft.
• Differentiating access permissions for different users.

1. Query Processor :
It interprets the requests (queries) received from end user via an application
program into instructions. It also executes the user request which is received
from the DML compiler.
Query Processor contains the following components –

• DML Compiler –
It processes the DML statements into low level instruction (machine
language), so that they can be executed.

• DDL Interpreter –
It processes the DDL statements into a set of table containing meta
data (data about data).

• Embedded DML Pre-compiler –


It processes DML statements embedded in an application program
into procedural calls.

• Query Optimizer –
It executes the instruction generated by DML Compiler.

2. Storage Manager :
Storage Manager is a program that provides an interface between the data
stored in the database and the queries received. It is also known as Database
Control System. It maintains the consistency and integrity of the database by
applying the constraints and executes the DCL statements. It is responsible for
updating, storing, deleting, and retrieving data in the database.
It contains the following components –

• Authorization Manager –
It ensures role-based access control, i.e,. checks whether the
particular person is privileged to perform the requested operation or
not.
• Integrity Manager –
It checks the integrity constraints when the database is modified.

• Transaction Manager –
It controls concurrent access by performing the operations in a
scheduled way that it receives the transaction. Thus, it ensures that
the database remains in the consistent state before and after the
execution of a transaction.

• File Manager –
It manages the file space and the data structure used to represent
information in the database.

• Buffer Manager –
It is responsible for cache memory and the transfer of data between
the secondary storage and main memory.

3. Disk Storage :
It contains the following components –

• Data Files –
It stores the data.

• Data Dictionary –
It contains the information about the structure of any database object.
It is the repository of information that governs the metadata.

• Indices –
It provides faster retrieval of data item.
7 ANS):

1. Hierarchical Data Model :


Hierarchical data model is the oldest type of the data model. It was developed
by IBM in 1968. It organizes data in the tree-like structure. Hierarchical model
consists of the the following :
• It contains nodes which are connected by branches.
• The topmost node is called the root node.
• If there are multiple nodes appear at the top level, then these can be
called as root segments.
• Each node has exactly one parent.
• One parent may have many child.
2. Network Data Model :
It is the advance version of the hierarchical data model. To organize data it
uses directed graphs instead of the tree-structure. In this child can have more
than one parent. It uses the concept of the two data structures i.e. Records and
Sets.

3. Relational Data Model :


The relational data model was developed by E.F. Codd in 1970. Their are no
physical links as they are in the hierarchical data model. Following are the
properties of the relational data model :
• Data is represented in the form of table only.
• It deals only with the data not with the physical structure.
• It provides information regarding metadata.
• At the intersection of row and column there will be only one value for
the tuple.
• It provides a way to handle the queries with ease.

Hierarchical Data Model Network Data Model Relational Data Model

It organizes records in the


In this model, to store data form of table and
hierarchy method is used. It organizes records to relationship between tables
It is the oldest method and one another through are set using common
not in use today. links or pointers. fields.

It organizes records in
To organize records, it the form of directed It organizes records in the
uses tree structure. graphs. form of tables.

In addition to 1:1 and


1:n it also implements In addition to 1:1 and 1:n it
It implements 1:1 and 1:n many to many also implements many to
relations. relationships. many relationships.

Insertion anomaly exits in


this model i.e. child node
cannot be inserted without There is no insertion There is no insertion
the parent node. anomaly. anomaly.
UNIT-2

1 ANS):
Super Key:
Super Key is an attribute (or set of attributes) that is used to uniquely identifies
all attributes in a relation. All super keys can’t be candidate keys but its reverse
is true. In a relation, number of super keys are more than number of candidate
keys

Candidate Key:
Candidate key is a set of attributes (or attribute) which uniquely identify the
tuples in a relation or table. As we know that Primary key is a minimal super
key, so there is one and only one primary key in any relation but there is more
than one candidate key can take place. Candidate key’s attributes can contain
NULL value which oppose to the primary key.

Primary Key:
Candidate key is a set of attributes (or attribute) which uniquely identify the
tuples in a relation or table. There can be more than one candidate key in
relation out of which one can be chosen as the primary key.

2ANS):

RA ,RC.pdf

3ANS):

SQL Set Operation


The SQL Set operation is used to combine the two or more SQL SELECT statements.

Types of Set Operation


1. Union
2. UnionAll

3. Intersect
4. Minus

1. Union
o The SQL Union operation is used to combine the result of two or more SQL SELECT queries.

o In the union operation, all the number of datatype and columns must be same in both the
tables on which UNION operation is being applied.

o The union operation eliminates the duplicate rows from its resultset.

Syntax:

1. SELECT column_name FROM table1


UNION
2. SELECT column_name FROM table2;

2. Union All
Union All operation is equal to the Union operation. It returns the set without removing
duplication and sorting the data.

Syntax:

1. SELECT column_name FROM table1


UNION ALL
2. SELECT column_name FROM table2;

3. Intersect
o It is used to combine two SELECT statements. The Intersect operation returns the common
rows from both the SELECT statements.

o In the Intersect operation, the number of datatype and columns must be the same.

o It has no duplicates and it arranges the data in ascending order by default.

Syntax

1. SELECT column_name FROM table1


INTERSECT
2. SELECT column_name FROM table2;
4. Minus
o It combines the result of two SELECT statements. Minus operator is used to display the rows
which are present in the first query but absent in the second query.

o It has no duplicates and data arranged in ascending order by default.

Syntax:

1. SELECT column_name FROM table1


MINUS
2. SELECT column_name FROM table2;

4 ANS):

Relational Calculus
o Relational calculus is a non-procedural query language. In the non-procedural query language,
the user is concerned with the details of how to obtain the end results.

o The relational calculus tells what to do but never explains how to do.

1. Tuple Relational Calculus (TRC)


o The tuple relational calculus is specified to select the tuples in a relation. In TRC, filtering
variable uses the tuples of a relation.

o The result of the relation can have one or more tuples.

Notation:

1. {T | P (T)} or {T | Condition (T)}

Where

T is the resulting tuples

P(T) is the condition used to fetch T.


2. Domain Relational Calculus (DRC)
o The second form of relation is known as Domain relational calculus. In domain relational
calculus, filtering variable uses the domain of attributes.

o Domain relational calculus uses the same operators as tuple calculus. It uses logical connectives
∧ (and), ∨ (or) and ┓ (not).

o It uses Existential (∃) and Universal Quantifiers (∀) to bind the variable.

Notation:

1. { a1, a2, a3, ..., an | P (a1, a2, a3, ... ,an)}

5ANS ):
https://www.geeksforgeeks.org/set-theory-operations-in-relational-
algebra/

6ANS):
https://www.geeksforgeeks.org/sql-correlated-
subqueries/#:~:text=With%20a%20normal%20nested%20subquery%2C%20the%20inne
r%20SELECT,inner%20query%20is%20driven%20by%20the%20outer%20query.

You might also like