0% found this document useful (0 votes)
41 views

Database Management System

This document contains a student's submission for their Database Management Systems lab at Jamia Hamdard University. It includes 9 questions and answers related to database concepts such as the roles and functions of a database administrator, the 3-tier architecture of DBMS, transaction processing schedules, database schema vs instance, Codd's 12 rules of the relational model, conflict serializability, database recovery checkpoints, and the transaction lifecycle. The submission is signed by the student, Harsh Sharma, and submitted to their professor Dr. Tabish Mufti for the third semester Bachelors of Computer Applications program.

Uploaded by

Hiral Bhardwaj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Database Management System

This document contains a student's submission for their Database Management Systems lab at Jamia Hamdard University. It includes 9 questions and answers related to database concepts such as the roles and functions of a database administrator, the 3-tier architecture of DBMS, transaction processing schedules, database schema vs instance, Codd's 12 rules of the relational model, conflict serializability, database recovery checkpoints, and the transaction lifecycle. The submission is signed by the student, Harsh Sharma, and submitted to their professor Dr. Tabish Mufti for the third semester Bachelors of Computer Applications program.

Uploaded by

Hiral Bhardwaj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

JAMIA HAMDARD

ODD SEMESTER-2022

DBMS LAB
(BCA-305)

SUBMITTED FOR
BACHELORS OF COMPUTER APPLICATIONS

SUBMITTED BY SUBMITTED TO

HARSH SHARMA PROF. DR TABISH MUFTI


ENROLL. NO.-2021-301-068 DEPTT. OF COMPUTER SCIENCE AND
BCA 3RD SEMESTER ENGG. JAMIA HAMDARD, NEW DELHI

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


SCHOOL OF ENGINEERING SCIENCE AND TECHNOLOGY
JAMIA HAMDARD, NEW DELHI-110062
Q-1 Who is Databases Administrator? Explain 10 Functions of Database
Administrator.
 A DBA or a Database Administrator is a person or a group of people who keeps
track of a Database.
 Right from creating a database, managing, updating, deleting a query generation
is done by DBA.
 A DBA can be a person or group of people who works together for the
consistency of a database.
 A DBA is a job profile having a certain type of skillset.

Functions of DBA
 Creating and maintaining database standards and policies
 Supporting database design, creation, and testing activities
 Managing the database availability and performance, including incident and
problem management
 Administering database objects to achieve optimum utilization
 Defining and implementing event triggers that will alert on potential database
performance or integrity issues
 Performing database housekeeping, such as tuning, indexing, etc.
 Monitoring usage, transaction volumes, response times, concurrency levels, etc.
 Identifying reporting, and managing database security issues, audit trails, and
forensics
 Designing database backup, archiving, and storage strategy

Q-2 Explain 3-tier Architecture of DBMS.


The architecture of DBMS is 3 fold:
1. Internal Level- The Internal level of a DBMS describes the actual physical
storage of the data or the way in which the data is actually stored in memory.
This level is not relational because data is stored according to the various coding
schemes instead of tabular form.
2. Conceptual level- The Conceptual Level is also known as logical level which
describes the overall logical structure of whole database for a community of
users.
3. External Level- The External Level is concerned with the individual users. The
users availing the services of software are not concerned about the backend.
There is no direct connection with the software.
Q-3 What are schedule in transaction processing? Differentiate between Serial
and Non-Serial Schedule.
A series of operations from one transaction to another transaction is known as
schedule. It is used to preserve the order of the operation in each individual transaction.
Serial Scheduling Non-Serial scheduling
A serial schedule is a sequence of A Non-Serial Schedule is a schedule
operations by a set of concurrent where the operations of a group of
transaction that preserve the order of concurrent transactions are interleaved.
operations in each of the individual
transactions.
Transactions are performed in serial order. Transactions are performed in non-serial
order, but the result should be same as
serial.
No interference between transactions. Concurrency problem can arise here.
It does not matter which transaction is The problem we have seen earlier lost
executed first, as long as every transaction update, uncommitted data, inconsistent
is executed in it’s entirely from beginning analysis is arise if scheduling is not proper.
to end.
A serial schedule gives the benefit of In this schedule there is benefit of
concurrent execution without any problem. concurrent execution.
Serial schedule that does interleaved the When no serial schedule has only fix
actions of different transactions. actions of any transaction.

Q-4 What is Database Schema and Database Instance?

Database Schema
It describes the organisation of data and relationships within the database. The design
of the database is called Schema. It represents a logical view of database.
Database Instance
The data stored in the database at a particular moment of time is called Instance of a
Database. As we know, Database Schema defines the attributes in the tables that
belongs to a particular Database. The values of these attributes at a moment of time is
called the Instance of Database.

Q-5 Explain 12-Codd rules of Relational Model.


CODD proposed 13 rules known as to test the DBMS concepts
1 Zero Rules
This rules starts that for 0 systems through qualify as RDBMS, it must be able to
manage database entirely through relational capabilities.

2 Information Rule
All the data or information in DBMS is to be represented as stored data in the cells of
table. The rows and columns have to be unordered.
3 Guarantee Access Rule
Each unit peace of data should be accessible by primary key (rows) + table name+
attributes (columns).

4 Systematic Treatment of New Values.


Create table Si
{
First_name Text NULL;
Middle_Name Text NULL;
Last_Name Text NULL;
}

NULL has several meanings; it can be a missing data, not applicable or no values. It
should be handled consistently. And primary key cannot be NULL.

5 Active Online Catalog


Database Dictionary (catalog) is the structure description of complete database it must
be stored online. The catalog must be governed by some rules as rest of the database.
The same query language will be used.

6 Powerful and well structured language


One well structured language must be there to provide all manners of access to the
data store in the database.

7 High Level Insert, Update and delete rule


A database must support high level insertion, updation and deletion. This must not be
limited to single to single rule. Hence it should be applicable to entire database.

8 View, Update Rule


This rule specifies that a database can be a updated by theoretical concept should also
be updatable by a system.

9 Logical Independence
It states that logical data in database must be independent to its users.

10 Integrity and Independence


A database must be independent of the application uses it or its integrity constraints can
be independently modified without the need of any change in the application. The rules
make Database independent of the front end application and interface.

11 Distribution Independence
The end user must not be able to see the data that is distributes over the network
through the locations.

12 Non-Subversion
It states that system has an interface that provides access to low level records then
interface must not be able to subvert system and bypass security and integrity
constraints.

Q-6 What is Conflict Serializability? Check from a given schedule whether


schedule is Conflict Serializable or not.
T1 T2 T3

R(x)

W(y)

R(z)

W(z)
Q-7 Explain checkpoint in DBMS recovery.
A checkpoint is used to declare a point before which DBMS was in consistent state and
all transaction work committed.
During transaction execution, such checkpoints are traced. After execution, transaction
log files will be created.
Upon reaching the savepoint/checkpoint, the log file is destroyed by saving its update to
the database. Then a new log is created with upcoming execution operations of the
transaction and it will be updated until the next checkpoint and the process continues.
Whenever transaction logs are created in a real-time environment, it eats up lots of
storage space. Also keeping track of every update and its maintenance may increase
the physical space of the system. Eventually, the transaction log file may not be
handled as the size keeps growing. This can be addressed with checkpoints. The
methodology utilized for removing all previous transaction logs and storing them in
permanent storage is called a Checkpoint.

Q-8 Explain transaction lifecycle with diagram.


The Database Transaction refers to the small unit of any given program that consists
of low level task. Every transaction in DBMS must maintain ACID property, where:
A-Atomicity
C- Consistency
I- Integrity
D-Durability
A transaction is set to be complete, maintain accuracy, and has a tendency to
maintain integrity of the data if it satisfies ACID property.
A Database transaction is a logical unit of processing in a DBMS which applies more
DB access through operators.
A DB transaction represents real world events of any organisation. All types of DB
access operation are held between the beginning and end transaction.
R-Read
W-Write
E-Execute

T1 T2 T3
R(x)
W(x)
R(a)
R(a)
W(y)
R(a)
Transaction Lifecycle
1) Once a transaction states execution, it becomes active. It can issue read and
write operation.
2) Once a read and write operation is complete has completed the transaction
becomes partially committed state.
3) If the check is success, the transaction commits and enters into a committed
state.
4) If the check is failed, the transaction goes to a failed state.
5) If the transaction is aborted in an active state, then it goes into a failed state.
The transaction should be rolled back to undo the effects of its write operation
on the Database.
6) The terminate state refers to the transaction leaving the system.
Q-9 Differentiate between DDL, DML, DCL and TCL Commands.

DDL (Data Definition Language):


Data Definition Language is used to define the database structure or schema. DDL is
also used to specify additional properties of the data. The storage structure and access
methods used by the database system by a set of statements in a special type of DDL
called a data storage and definition language. These statements define the
implementation details of the database schema, which are usually hidden from the
users. The data values stored in the database must satisfy certain consistency
constraints. 
CREATE: to create objects in database
ALTER: alters the structure of database
DROP: delete objects from database
RENAME: rename an objects
DML (Data Manipulation Language):
DML statements are used for managing data within schema objects. 
DML are of two types – 
 
Procedural DMLs: require a user to specify what data are needed and how to get those
data.
Declarative DMLs (also referred as Non-procedural DMLs): require a user to specify
what data are needed without specifying how to get those data. 
Declarative DMLs are usually easier to learn and use than procedural DMLs. However,
since a user does not have to specify how to get the data, the database system has to
figure out an efficient means of accessing data.
Some Commands: 
 
SELECT: retrieve data from the database
INSERT: insert data into a table
UPDATE: update existing data within a table
DELETE: deletes all records from a table, space for the records remain

TCL (Transaction Control Language):


Transaction Control Language commands are used to manage transactions in the
database. These are used to manage the changes made by DML-statements. It also
allows statements to be grouped together into logical transactions. 
Examples of TCL commands – 
 
COMMIT: Commit command is used to permanently save any transaction into the
database.
ROLLBACK: This command restores the database to last committed state. It is also
used with savepoint command to jump to a savepoint in a transaction.
SAVEPOINT: Savepoint command is used to temporarily save a transaction so that you
can rollback to that point whenever necessary.

DCL (Data Control Language):


A Data Control Language is a syntax similar to a computer programming language used
to control access to data stored in a database (Authorization). In particular, it is a
component of Structured Query Language (SQL). 
Examples of DCL commands: 
 
GRANT: allow specified users to perform specified tasks.
REVOKE: cancel previously granted or denied permissions.

Q-10 Explain the concept of Deadlock in DBMS.


In a database, a deadlock is an unwanted situation in which two or more transactions
are waiting indefinitely for one another to give up locks. Deadlock is said to be one of
the most feared complications in DBMS as it brings the whole system to a Halt. 
A system is set to be in deadlock state if there exist a set of transactions {T1, T2, …,
Tn} such that such that each transaction in set is waiting for realize resource by any
order, transaction in that state goes to a waiting state.

Deadlock Avoidance – 
When a database is stuck in a deadlock, It is always better to avoid the deadlock rather
than restarting or aborting the database. The deadlock avoidance method is suitable for
smaller databases whereas the deadlock prevention method is suitable for larger
databases. 
One method of avoiding deadlock is using application-consistent logic. In the above-
given example, Transactions that access Students and Grades should always access
the tables in the same order. In this way, in the scenario described above, Transaction
T1 simply waits for transaction T2 to release the lock on Grades before it begins. When
transaction T2 releases the lock, Transaction T1 can proceed freely. 
Another method for avoiding deadlock is to apply both row-level locking mechanism and
READ COMMITTED isolation level. However, It does not guarantee to remove
deadlocks completely. 

Deadlock Detection – 
When a transaction waits indefinitely to obtain a lock, The database management
system should detect whether the transaction is involved in a deadlock or not. 
 Wait-for-graph is one of the methods for detecting the deadlock situation. This
method is suitable for smaller databases. In this method, a graph is drawn based
on the transaction and their lock on the resource. If the graph created has a
closed-loop or a cycle, then there is a deadlock. 

Deadlock prevention – 
For a large database, the deadlock prevention method is suitable. A deadlock can be
prevented if the resources are allocated in such a way that deadlock never occurs. The
DBMS analyzes the operations whether they can create a deadlock situation or not, If
they do, that transaction is never allowed to be executed. 
Deadlock prevention mechanism proposes two schemes: 
 
 Wait-Die Scheme – 
In this scheme, If a transaction requests a resource that is locked by another
transaction, then the DBMS simply checks the timestamp of both transactions
and allows the older transaction to wait until the resource is available for
execution. 

 Wound Wait Scheme – 


In this scheme, if an older transaction requests for a resource held by a younger
transaction, then an older transaction forces a younger transaction to kill the
transaction and release the resource. The younger transaction is restarted with a
minute delay but with the same timestamp. If the younger transaction is
requesting a resource that is held by an older one, then the younger transaction
is asked to wait till the older one releases it. 
Q-11 Explain ACID property to describe the integrity of data.

A- Atomicity
C- Consistency
I- Isolation
D- Durability
In DBMS, data is the integral part of a database. Each and every database should
follow ACID property to maintain the integrity of the data.

Atomicity-
The term Atomicity defines that the data remains atomic in nature. It means that if any
operation is performed in the data, either it should be executed or should not be
executed at all.

Consistency-
The word Consistency means that the value should be reserved in the database.

Isolation-
The term Isolation means separation. In DBMS Isolation property of database states
that only necessary features are being stored and unnecessary features are hidden.

Durability-
The term Durability means permanency in the database. In Durability, operations are
successfully executed and becomes permanent in the database.

Q- 12 What are joins? What are the types of joins with SQL command?
A JOIN is a SQL command that combines rows from two or more tables based on a
related column between them.
There are several types of JOINs in SQL:
1) INNER JOIN: An INNER JOIN returns only the rows that match the join condition
in both tables. It is the most commonly used type of JOIN. The syntax for an
INNER JOIN is as follows:
SELECT *
FROM table1
INNER JOIN table2
ON table1.common_column = table2.common_column;
2) LEFT JOIN: A LEFT JOIN returns all rows from the left table, and any matching
rows from the right table. If there is no match, NULL values are returned for the
right table's columns. The syntax for a LEFT JOIN is as follows:

SELECT *
FROM table1
LEFT JOIN table2
ON table1.common_column = table2.common_column;
3) RIGHT JOIN: A RIGHT JOIN is similar to a LEFT JOIN, but it returns all rows
from the right table and any matching rows from the left table. If there is no
match, NULL values are returned for the left table's columns. The syntax for a
RIGHT JOIN is as follows:
SELECT *
FROM table1
RIGHT JOIN table2
ON table1.common_column = table2.common_column;
4) FULL OUTER JOIN: A FULL OUTER JOIN returns all rows from both tables,
whether or not there is a match in the other table. If there is no match, NULL
values are returned for the missing columns. The syntax for a FULL OUTER
JOIN is as follows:
SELECT *
FROM table1
FULL OUTER JOIN table2
ON table1.common_column = table2.common_column;
5) CROSS JOIN: A CROSS JOIN returns the Cartesian product of two tables,
which is the number of rows in the first table multiplied by the number of rows in
the second table. A CROSS JOIN does not require a join condition, as it returns
every possible combination of rows from both tables. The syntax for a CROSS
JOIN is as follows:
SELECT *
FROM table1
CROSS JOIN table2;

It is important to note that JOINs can also be combined with WHERE clauses to further
filter the results. For example, you can use a LEFT JOIN and a WHERE clause to return
only the rows that match the join condition in the left table and NULL values for the right
table's columns, as shown below:

C
SELECT *
FROM table1
LEFT JOIN table2
ON table1.common_column = table2.common_column
WHERE table2.common_column IS NULL;

Q-13 What is Deadlock? Explain 4 conditions of deadlock.


In a database, a deadlock is an unwanted situation in which two or more transactions
are waiting indefinitely for one another to give up locks. Deadlock is said to be one of
the most feared complications in DBMS as it brings the whole system to a Halt. 
There are four conditions necessary for the occurrence of a deadlock. They can be
understood with the help of the 00illustrated example of staircase:
1. Mutual Exclusion: When two people meet in the landings, they can’t just walk
through because there is space only for one person. This condition allows only one
person (or process) to use the step between them (or the resource) is the first
condition necessary for the occurrence of the deadlock.

2. Hold and Wait: When the two people refuse to retreat and hold their ground, it is
called holding. This is the next necessary condition for deadlock.

3. No Preemption: For resolving the deadlock one can simply cancel one of the
processes for other to continue. But the Operating System doesn’t do so. It
allocates the resources to the processors for as much time as is needed until the
task is completed. Hence, there is no temporary reallocation of the resources. It is
the third condition for deadlock.
4. Circular Wait: When the two people refuse to retreat and wait for each other to
retreat so that they can complete their task, it is called circular wait. It is the last
condition for deadlock to occur.

Note: All four conditions are necessary for deadlock to occur. If any single one is
prevented or resolved, the deadlock is resolved.

Q-14 What is Normalization in DBMS? Explain 1st Normal form (1NF).


Data Normalization is process for collecting and evaluating table structure to reduce
data redundancy thus reducing data anomalies. If the DB is not perfect, it may contain
anomalies(various types of errors) which is like a bad dream for Database
Administrator.
1st Normal Form
A relation is in first NF if every attribute is a single valued or does not contain any mutli
value.

Q-15. What is View Serializability? Explain all 3 conditions of View Serializability


View Serializability is a concept that is used to compute whether schedules are View-
Serializable or not. A schedule is said to be View-Serializable if it is view equivalent
to a Serial Schedule (where no interleaving of transactions is possible). 
There are 3 conditions of View serializability which should be verified-
1) Initial Read 
If a transaction T1 reading data item A from database in S1 then in S2 also T1 should
read A from database. 
 
T1 T2 T3
-----------------------------
R(A)
W(A)
R(A)
R(B)
Transaction T2 is reading A from database. 
2)Updated Read 
If Ti is reading A which is updated by Tj in S1 then in S2 also Ti should read A which is
updated by Tj. 
 
T1 T2 T3 T1 T2 T3
----------------------------- ---------------------------
W(A) W(A)
W(A) R(A)
R(A) W(A)
Above two schedule are not view-equivalent as in S1 :T3 is reading A updated by T2, in
S2 T3 is reading A updated by T1. 

3)Final Write operation 


If a transaction T1 updated A at last in S1, then in S2 also T1 should perform final write
operations. 
 
T1 T2 T1 T2
--------------- ---------------
R(A) R(A)
W(A) W(A)
W(A) W(A)
Above two schedules are not view-equivalent as Final write operation in S1 is done by
T1 while in S2 done by T2. 
16. Differentiate between DBMS vs. RDBMS
DBMS RDBMS
DBMS stores data as file. RDBMS stores data in tabular form.
Data elements need to access Multiple data elements can be accessed at the
individually. same time.
No relationship between data. Data is stored in the form of tables which are
related to each other.
Normalization is not present. Normalization is present.
DBMS does not support distributed RDBMS supports distributed database.
database.
It stores data in either a navigational It uses a tabular structure where the headers
or hierarchical form. are the column names, and the rows contain
corresponding values.
It deals with small quantity of data. It deals with large amount of data.
Data redundancy is common in this Keys and indexes do not allow Data
model. redundancy.
It is used for small organization and It is used to handle large amount of data.
deal with small data.
It supports single user. It supports multiple users.
Data fetching is slower for the large Data fetching is fast because of relational
amount of data. approach.
The data in a DBMS is subject to low There exists multiple levels of data security in a
security levels with regards to data RDBMS.
manipulation.
Low software and hardware Higher software and hardware necessities.
necessities.
Examples: XML, Window Registry, Examples: MySQL, PostgreSQL, SQL Server,
etc. Oracle, Microsoft Access etc.
17. What is relational model in DBMS?
The relational model represents how data is stored in Relational Databases.  A
relational database stores data in the form of relations (tables).
Constraints in Relational Model
While designing the Relational Model, we define some conditions which must hold for
data present in the database are called Constraints. These constraints are checked
before performing any operation (insertion, deletion, and updation ) in the database. If
there is a violation of any of the constraints, the operation will fail. 
Domain Constraints: These are attribute-level constraints. An attribute can only take
values that lie inside the domain range. e.g; If a constraint AGE>0 is applied to
STUDENT relation, inserting a negative value of AGE will result in failure. 
Key Integrity: Every relation in the database should have at least one set of attributes
that defines a tuple uniquely. Those set of attributes is called keys. e.g.; ROLL_NO in
STUDENT is a key. No two students can have the same roll number. So a key has two
properties: 
 It should be unique for all tuples.
 It can’t have NULL values.
Referential Integrity: When one attribute of a relation can only take values from
another attribute of the same relation or any other relation, it is called referential
integrity.

Q-18 Check from Given schedule whether there is a deadlock or not

Time Transaction Code


T1 T2 Lock(A,X)
T2 T1 Lock(C,S)
T3 T3 Lock(B,S)
T4 T5 Lock(A,S)
T5 T4 Lock(B,X)
19. What is Data flow diagram (DFD)? Explain 4 elements of DFD
Data Flow Diagram (DFD) is a graphical representation of data flow in any system. It is
capable of illustrating incoming data flow, outgoing data flow and store data. Data flow
diagram describes anything about how data flows through the system.
Components of Data Flow Diagram:
 Entities:
Entities include source and destination of the data. Entities are represented by
rectangle with their corresponding names.
 Process:
The tasks performed on the data is known as process. Process is represented by
circle. Somewhere round edge rectangles are also used to represent process.
 Data Storage:
Data storage includes the database of the system. It is represented by rectangle
with both smaller sides missing or in other words within two parallel lines.
 Data Flow:
The movement of data in the system is known as data flow. It is represented with
the help of arrow. The tail of the arrow is source and the head of the arrow is
destination.

20. Explain 10 Applications of DBMS


1) Railway Reservation System –
In the rail route reservation framework, the information base is needed to store
the record or information of ticket appointments, status about train’s appearance,
and flight. Additionally, if trains get late, individuals become acquainted with it
through the information base update.  
 
2) Library Management System –
There are lots of books in the library so; it is difficult to store the record of the
relative multitude of books in a register or duplicate. Along these lines, the data
set administration framework (DBMS) is utilized to keep up all the data identified
with the name of the book, issue date, accessibility of the book, and its writer.  
 
3) Banking –
Database the executive’s framework is utilized to store the exchange data of the
client in the information base.
  
4) Education Sector –
Presently, assessments are led online by numerous schools and colleges. They
deal with all assessment information through the data set administration
framework (DBMS). In spite of that understudy’s enlistments subtleties, grades,
courses, expense, participation, results, and so forth all the data is put away in
the information base.  

 
5) Credit card exchanges – 
The database Management framework is utilized for buying on charge cards and
age of month to month proclamations.  
 
6) Social Media Sites –
We all utilization of online media sites to associate with companions and to
impart our perspectives to the world. Every day, many people group pursue
these online media accounts like Pinterest, Facebook, Twitter, and Google in
addition to. By the utilization of the data set administration framework, all the data
of clients are put away in the information base and, we become ready to interface
with others.  
 
7) Broadcast communications – 
Without DBMS any media transmission organization can’t think. The Database
the executive’s framework is fundamental for these organizations to store the call
subtleties and month to month postpaid bills in the information base.  
 
8) Account –
The information base administration framework is utilized for putting away data
about deals, holding and acquisition of monetary instruments, for example,
stocks and bonds in a data set. 
 
9) Online Shopping – 
These days, web-based shopping has become a major pattern. Nobody needs to
visit the shop and burn through their time. Everybody needs to shop through web
based shopping sites, (for example, Amazon, Flipkart, Snapdeal) from home. So
all the items are sold and added uniquely with the assistance of the information
base administration framework (DBMS). Receipt charges, installments, buy data
these are finished with the assistance of DBMS.  
 
10)Human Resource Management – 
Big firms or organizations have numerous specialists or representatives working
under them. They store data about worker’s compensation, assessment, and
work with the assistance of an information base administration framework
(DBMS).  
21. What is deadlock Prevention? Explain deadlock prevention conditions
Deadlock Prevention 
We can prevent Deadlock by eliminating any of the four conditions. 
1) Eliminate Mutual Exclusion 
It is not possible to dis-satisfy the mutual exclusion because some resources, such as
the tape drive and printer, are inherently non-shareable. 
2) Eliminate Hold and wait 
Allocate all required resources to the process before the start of its execution, this way
hold and wait condition is eliminated but it will lead to low device utilization. for example,
if a process requires printer at a later time and we have allocated printer before the start
of its execution printer will remain blocked till it has completed its execution. 
The process will make a new request for resources after releasing the current set of
resources. This solution may lead to starvation.
3) Eliminate No Preemption 
Preempt resources from the process when resources required by other high priority
processes. 
4) Eliminate Circular Wait 
Each resource will be assigned with a numerical number. A process can request the
resources increasing/decreasing. order of numbering. 
For Example, if P1 process is allocated R5 resources, now next time if P1 ask for R4,
R3 lesser than R5 such request will not be granted, only request for resources more
than R5 will be granted. 

22. What are attributes in ER diagram?


 Simple attribute : 
An attribute that cannot be further subdivided into components is a simple
attribute. 
Example: The roll number of a student, the id number of an employee. 
 Composite attribute : 
An attribute that can be split into components is a composite attribute. 
Example: The address can be further split into house number, street number,
city, state, country, and pin code, the name can also be split into first name
middle name, and last name. 
 Single-valued attribute : 
The attribute which takes up only a single value for each entity instance is a
single-valued attribute. 
Example: The age of a student. 
 Multi-valued attribute : 
The attribute which takes up more than a single value for each entity instance is
a multi-valued attribute. 
Example: Phone number of a student: Landline and mobile. 
 Derived attribute : 
An attribute that can be derived from other attributes is derived attributes. 
Example: Total and average marks of a student. 
 Complex attribute : 
Those attributes, which can be formed by the nesting of composite and multi-
valued attributes, are called “Complex Attributes“. These attributes are rarely
used in DBMS(DataBase Management System). That’s why they are not so
popular.
 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.

23. Write short notes on


a) Primary Key
A primary key is used to ensure that data in the specific column is unique. A column
cannot have NULL values. It is either an existing table column or a column that is
specifically generated by the database according to a defined sequence. 
b) Candidate Key
A candidate key is a subset of the super key that can uniquely identify the other
attributes of the table. A table can have more than one candidate key. The candidate
key helps in determining the prime and non-prime attributes of a table and ensures the
integrity of the data by preventing duplicate data.
c) Super Key
A superkey is a combination of columns that uniquely identifies any row within a
relational database management system (RDBMS) table. A candidate key is a closely
related concept where the superkey is reduced to the minimum number of columns
required to uniquely identify each row.
d) Composite Key
In database design, a composite key is a candidate key that consists of two or more
attributes (table columns) that together uniquely identify an entity occurrence (table
row). A compound key is a composite key for which each attribute that makes up the
key is a foreign key in its own right.

24. Explain SQL commands


a) CREATE database
In SQL, the 'Create Database' statement is a first step for storing the structured data in
the database. The database developers and the users use this statement in SQL for
creating the new database in the database systems. It creates the database with the
name which has been specified in the Create Database statement.
b) ROLLBACK
ROLLBACK is a transactional control language in SQL. It lets a user undo those
transactions that aren't saved yet in the database. One can make use of this command
if they wish to undo any changes or alterations since the execution of the last COMMIT.
c) DELETE
The Delete command in SQL is a part of the Data Manipulation Language, a sub-
language of SQL that allows modification of data in databases. This command is used
to delete existing records from a table. Using this, you can either delete specific records
based on a condition or all the records from a table.
d) WHERE
The SQL WHERE clause is used to specify a condition while fetching the data from a
single table or by joining with multiple tables. If the given condition is satisfied, then only
it returns a specific value from the table. You should use the WHERE clause to filter the
records and fetching only the necessary records.

You might also like