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

Komal DBMS

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

Komal DBMS

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

PRACTICAL FILE

ON
“Database Management System”
(Subject Code: - KCA-252)

SUBMITTED TO: SUBMITTED BY:


Prof. Anil Kumar Singh Name:- KOMAL SINGH
Prof. & Dean (Academic Affairs) AKTU Roll No.:-2204340140035
DEPARTMENT OF MCA MCA-2 Semester
nd

Jagran Institute of Management, Batch:-2022-2024


Kanpur
Certificate

This is to certify that the “Database Management System Lab (KCA-


252)” File has been carried out by “Komal Singh”, Roll No.:-
2204340140035 Jagran Institute of Management, Kanpur, under my
guidance and supervision in partial fulfillment of the Master of
Computer Application (MCA-2nd Semester ) during the academic Session
-2022-2023 (Batch-2022-24 ) is carried out by her under our guidance
and supervision.

(Sign :-___________)

Prof. Anil Kumar Singh


Prof. & Dean (Academic Affairs)
DEPARTMENT OF MCA

Jagran Institute of Management, Kanpur


Acknowledgement
Before I proceed further, I would like to spend some time expressing my gratitude to all
those who have been involved in guiding me out during the entire curriculum.

I wish to express my most sincere and profound gratitude to


Prof. Anil Kumar Singh, Prof. & Dean (Academic Affairs), Department of MCA, Jagran
Institute of Management, Kanpur for giving me inspiration and requisite facility by giving
me a chance to show my capabilities and also for making me feel comfortable in the
strictly professional environment of the college premises.

I am also grateful for his cooperation in providing me with all the required resources.

I would like to extend special thanks to all my colleagues for their help and constant
support.

This work cannot be completed without the help of above mentioned person.

-With gratitude

(Student’s Signatre :-___________)

Student Name:-Komal Singh


AKTU Roll Number:- 2204340140035
MCA-2nd Semester
Session:-2022-2023
Batch:-2022-24
FILE INDEX

S.No. Questions Page Sign /


No. Remarks
1. Explain the concept of a database Management 1-6
System.

2. Create a simple table structure for a student database, 7


including the necessary attributes and data types

3. Discuss the concept of normalization and its 8-9


importance in database design

4. Write SQL queries to perform the following operations: 10-11


a) Retrieve all records from a table.
b) Insert a new record into a table.
c) Update an existing record in a table.
d) Delete a record from a table.

5. Explain the concept of primary keys and foreign keys in 12-13


a relational database

6. Write SQL queries to perform the following operations: 14-17


a) Join two or more tables based on a common
column.
b) Retrieve records using different types of joins:
inner join, left join, and right join.
c) Perform rm aggregation functions (e.g., Min,
Max, count, sum, average) on a table.
7. Discuss the concept of database transactions and the 18-21
ACID properties

8. Describe the different types of database constraints 22-28


(e.g., unique, foreign key) and their purposes.

9. What is ER diagram and describe its components. 29-36

10. What are Keys in DBMS? 37-43

11. What is Functional Dependency? 44-48


KOMAL SINGH| Roll No. 2204340140035

1. Explain the concept of a database Management System.

INTRODUCTION:
A Database Management System (DBMS) is a software system that isdesigned to
manage and organize data in a structured manner. It allows users to create, modify,
and query a database, as well as manage the security and access controls for that
database.

Some key features of a DBMS include:


• Data modeling: A DBMS provides tools for creating and modifying data models,
which define the structure and relationships of the data in a database.
• Data storage and retrieval: A DBMS is responsible for storing and retrieving data
from the database, and can provide various methods for searching and querying the
data.
• Concurrency control: A DBMS provides mechanisms for controlling concurrent
access to the database, to ensure that multiple users can access the data without
conflicting with each other.
• Data integrity and security: A DBMS provides tools for enforcing data integrity and
security constraints, such as constraints on the values of data and access controls
that restrict who can access the data.
• Backup and recovery: A DBMS provides mechanisms for backing up and recovering
the data in the event of a system failure.
DBMS can be classified into two types: Relational Database Management System
(RDBMS) and Non-Relational Database Management System (NoSQL or Non-SQL)
RDBMS: Data is organized in the form of tables and each table has a set of rows and
columns. The data is related to each other through primary and foreign keys.
NoSQL: Data is organized in the form of key-value pairs, document, graph, or column-
based. These are designed to handle large-scale, high-performance scenarios.

Page 1 of 48
KOMAL SINGH| Roll No. 2204340140035

Database is a collection of interrelated data which helps in the efficient retrieval,


insertion, and deletion of data from the database and organizes the data in the form
of tables, views, schemas, reports, etc. For Example, a university database organizes
the data about students, faculty, admin staff, etc. which helps in the efficient retrieval,
insertion, and deletion of data from it.
There are four types of Data Languages -
1. Data Definition Language (DDL)
2. Data Manipulation Language(DML)
3. Data Control Language(DCL)
4. Transactional Control Language(TCL)

❖ DDL is the short name for Data Definition Language, which deals with database
schemas and descriptions, of how the data should reside in the database.
• CREATE: to create a database and its objects like (table, index, views, store
procedure, function, and triggers)
• ALTER: alters the structure of the existing database
• DROP: delete objects from the database
• TRUNCATE: remove all records from a table, including all spaces allocated for the
records are removed
• COMMENT: add comments to the data dictionary
• RENAME: rename an object.

❖ DML is the short name for Data Manipulation Language which deals with data
manipulation and includes most common SQL statements such SELECT, INSERT,
UPDATE, DELETE, etc., and it is used to store, modify, retrieve, delete and update
data in a database.
• SELECT: retrieve data from a database
• INSERT: insert data into a table
• UPDATE: updates existing data within a table

Page 2 of 48
KOMAL SINGH| Roll No. 2204340140035

• DELETE: Delete all records from a database table


• MERGE: UPSERT operation (insert or update)
• CALL: call a PL/SQL or Java subprogram
• EXPLAIN PLAN: interpretation of the data access path
• LOCK TABLE: concurrency Control.

❖ DCL is short for Data Control Language which acts as an access specifier to the
database.(basically to grant and revoke permissions to users in the database
• GRANT: grant permissions to the user for running DML(SELECT, INSERT, DELETE,…)
commands on the table
• REVOKE: revoke permissions to the user for running DML(SELECT, INSERT,
DELETE,…) command on the specified table.

❖ TCL is short for Transactional Control Language which acts as an manager for all types
of transactional data and all transactions.Some of the command of TCL are
• Roll Back: Used to cancel or Undo changes made in the database .
• Commit: It is used to apply or save changes in the database.
• Save Point: It is used to save the data on the temporary basis in the database.
Database Management System: The software which is used to manage databases is
called Database Management System (DBMS). For Example, MySQL, Oracle, etc. are
popular commercial DBMS used in different applications. DBMS allows users the
following tasks:
Data Definition: It helps in the creation, modification, and removal of definitions that
define the organization of data in the database.
Data Updation: It helps in the insertion, modification, and deletion of the actual data
in the database.
Data Retrieval: It helps in the retrieval of data from the database which can be used
by applications for various purposes.

Page 3 of 48
KOMAL SINGH| Roll No. 2204340140035

User Administration: It helps in registering and monitoring users, enforcing data


security, monitoring performance, maintaining data integrity, dealing with
concurrency control, and recovering information corrupted by unexpected failure.
Paradigm Shift from File System to DBMS

File System manages data using files on a hard disk. Users are allowed to create,
delete, and update the files according to their requirements. Let us consider the
example of file-based University Management System. Data of students is available to
their respective Departments, Academics Section, Result Section, Accounts Section,
Hostel Office, etc. Some of the data is common for all sections like Roll No, Name,
Father Name, Address, and Phone number of students but some data is available to a
particular section only like Hostel allotment number which is a part of the hostel
office. Let us discuss the issues with this system:

1. Redundancy of data: Data is said to be redundant if the same data is copied at


many places. If a student wants to change their Phone number, he or she has
to get it updated in various sections. Similarly, old records must be deleted
from all sections representing that student.
2. Inconsistency of Data: Data is said to be inconsistent if multiple copies of the
same data do not match each other. If the Phone number is different in
Accounts Section and Academics Section, it will be inconsistent. Inconsistency
may be because of typing errors or not updating all copies of the same data.
3. Difficult Data Access: A user should know the exact location of the file to
access data, so the process is very cumbersome and tedious. If the user wants
to search the student hostel allotment number of a student from 10000
unsorted students’ records, how difficult it can be.
4. Unauthorized Access: File Systems may lead to unauthorized access to data. If
a student gets access to a file having his marks, he can change it in an
unauthorized way.

Page 4 of 48
KOMAL SINGH| Roll No. 2204340140035

5. No Concurrent Access: The access of the same data by multiple users at the
same time is known as concurrency. The file system does not allow
concurrency as data can be accessed by only one user at a time.
6. No Backup and Recovery: The file system does not incorporate any backup and
recovery of data if a file is lost or corrupted.
ADVANTAGES OR DISADVANTAGES:
Advantages of using a DBMS:
• Data organization: A DBMS allows for the organization and storage of data in a
structured manner, making it easy to retrieve and query the data as needed.
• Data integrity: A DBMS provides mechanisms for enforcing data integrity
constraints, such as constraints on the values of data and access controls that
restrict who can access the data.
• Concurrent access: A DBMS provides mechanisms for controlling concurrent
access to the database, to ensure that multiple users can access the data without
conflicting with each other.
• Data security: A DBMS provides tools for managing the security of the data, such
as controlling access to the data and encrypting sensitive data.
• Backup and recovery: A DBMS provides mechanisms for backing up and recovering
the data in the event of a system failure.
• Data sharing: A DBMS allows multiple users to access and share the same data,
which can be useful in a collaborative work environment.
Disadvantages of using a DBMS:
• Complexity: DBMS can be complex to set up and maintain, requiring specialized
knowledge and skills.
• Performance overhead: The use of a DBMS can add overhead to the performance
of an application, especially in cases where high levels of concurrency are required.
• Scalability: The use of a DBMS can limit the scalability of an application, since it
requires the use of locking and other synchronization mechanisms to ensure data
consistency.

Page 5 of 48
KOMAL SINGH| Roll No. 2204340140035

• Cost: The cost of purchasing, maintaining and upgrading a DBMS can be high,
especially for large or complex systems.
• Limited use cases: Not all use cases are suitable for a DBMS, some solutions don’t
need high reliability, consistency or security and may be better served by other
types of data storage.
These are the main reasons which made a shift from file system to DBMS.

Page 6 of 48
KOMAL SINGH| Roll No. 2204340140035

2. Create a simple table structure for a student database, including the necessary
attributes and data types.
Query-
CREATE TABLE students (
S_ID INT PRIMARY KEY,
Name VARCHAR(10),
Class VARCHAR(15),
Age int(11),
DOB date,
address VARCHAR(15)
);

OUTPUT:

Page 7 of 48
KOMAL SINGH| Roll No. 2204340140035

3. Discuss the concept of normalization and its importance in database design.

Normalization is the process of reducing data redundancy in a table and improving


data integrity. Then why do you need it? If there is no normalization in SQL, there will
be many problems, such as:
• Insert Anomaly: This happens when we cannot insert data into the table without
another.
• Update Anomaly: This is due to data inconsistency caused by data redundancy and
data update.
• Delete exception: Occurs when some attributes are lost due to the deletion of
other attributes.
So normalization is a way of organizing data in a database. Normalization involves
organizing the columns and tables in the database to ensure that their dependencies
are correctly implemented using database constraints. Normalization is the process of
organizing data in a proper manner. It is used to minimize the duplication of various
relationships in the database. It is also used to troubleshoot exceptions such as
inserts, deletes, and updates in the table. It helps to split a large table into several
small normalized tables. Relational links and links are used to reduce redundancy.
Normalization, also known as database normalization or data normalization, is an
important part of relational database design because it helps to improve the speed,
accuracy, and efficiency of the database.

Basic normal forms:


A relation is considered in 1NF if every domain attribute consists of one atomic or
indiscreet value. it’s a really important property of a relationship that’s accessible
within the RDBMS.

A relation is in 2NF only if it is in 1NF also as all the non-key attributes in the tables are
addicted to the table’s primary key. this type applies to those relations that are

Page 8 of 48
KOMAL SINGH| Roll No. 2204340140035

connected using composite keys. The relation of the tables is coupled with a key that
is composed of over one attribute.

A relation is in 3NF if and only if it’s in 2NF and there’s no transition dependency.
The main use of normalization is to utilize in order to remove anomalies that are
caused because of the transitive dependency. Normalization is to minimize the
redundancy and remove Insert, Update and Delete Anomaly. It divides larger tables
into smaller tables and links them using relationships.

Need for normalization :


1) It eliminates redundant data.
2) It reduces chances of data error.
3) The normalization is important because it allows database to take up less disk
Space.
4) It also help in increasing the performance.
5) It improves the data integrity and consistency.

Advantages:
There are many benefits to normalizing a database. Some of the main advantages are:
1) By using normalization redundancy of database or data duplication can be
resolved.
2) We can minimize null values by using normalization.
3) Results in a more compact database (due to less data redundancy/zero).
4) Minimize/avoid data modification problems.
5) It simplifies the query.is
6) The database structure is clearer and easier to understand.
7) The database can be expanded without affecting existing data.
8) Finding, sorting, and indexing can be faster because the table is small and more
rows can be accommodated on the data page.

Page 9 of 48
KOMAL SINGH| Roll No. 2204340140035

4. Write SQL queries to perform the following operations:

a) Retrieve all records from a table.


SELECT column1, column2 FROM table1, table2 WHERE column2='value';
Example - SELECT * FROM Students;

b) Insert a new record into a table.


INSERT INTO TABLE_NAME (column1, column2, column3,...columnN) VALUES (value1,
value2, value3,...valueN);
Example -INSERT INTO Students (S_ID, Name, class, Age, DOB)
VALUES (6, 'Yuri', 'IX',14, '1991-06-08',);

c) Update an existing record in a table.


UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;

Page 10 of 48
KOMAL SINGH| Roll No. 2204340140035

Example -UPDATE Students


SET age=14 WHERE S_ID= 4;

d) Delete a record from a table.


DELETE FROM table_name WHERE condition;
Example -DELETE FROM Students
WHERE age = 12;

Page 11 of 48
KOMAL SINGH| Roll No. 2204340140035

5. Explain the concept of primary keys and foreign keys in a relational database.
In a relational database, keys are the most important elements to maintain the
relationship between two tables or to uniquely identify the data from a table. Primary
key is used to identify data uniquely therefore two rows can't have the same primary
key. It can't be null. On the other hand, foreign key is used to maintain relationship
between two tables.
The primary key of a table acts as the foreign key in another table. The Foreign key in a
table helps enforce Referential Integrity constraint. Read this tutorial to find out more
about Primary and Foreign keys and how they are different from each other.

Primary Key -
A primary key is a column (or set of columns) in a table that uniquely identifies each
row in the table. It cannot contain null values and must be unique across all rows in the
table. Only one primary key is allowed in a table.
A primary key is basically a combination of the 'UNIQUE' and 'Not Null' constraints.
Thus, it cannot be a NULL value. Another important point to be noted about primary
key is that its value cannot be deleted from the parent table.

Foreign Key -
A foreign key is a column (or set of columns) in a table that refers to the primary key in
another table. It is used to establish a link between the two tables and is used to enforce
referential integrity in the database. Foreign key is basically the field/column in a table
that is analogous to the primary key of other table.
Unlike a primary key, a table can have more than one foreign key. Also, the foreign key
can contain duplicate and null values in a relational database. The value of a foreign key
can be deleted from the child table.

Difference between Primary Key and Foreign Key in Database

The following table highlights all the important differences between primary key and
foreign key –

Primary keys and foreign keys are important concepts in database design as they help
to establish relationships between tables and help ensure data integrity. A primary key
uniquely identifies a row in a table, while a foreign key is used to link two tables
together by referencing the primary key of the related table. The most important
difference that you should note here is that a primary key cannot have a NULL value,
whereas a foreign key can accept NULL values.

Page 12 of 48
KOMAL SINGH| Roll No. 2204340140035

Key Primary Key Foreign Key

It is used to uniquely identify data in It is used to maintain relationship


Basic
the table. between tables.

Null It can't be NULL. It can accept the NULL values.

Two or more rows can't have same It can carry duplicate value for a
Duplicate
primary key. foreign key attribute.

Index Primary has clustered index. By default, It is not clustered index.

Primary key constraint can be defined It can't be defined on temporary


Tables
on temporary table. tables.

Page 13 of 48
KOMAL SINGH| Roll No. 2204340140035

6. Write SQL queries to perform the following operations:


a) Join two or more tables based on a common column.
SELECT *
FROM table1
INNER JOIN table2
ON table1.common_column = table2.common_column;
Structure-

b) Retrieve records using different types of joins: inner join, left join, and right join.
• Inner join-
SELECT *
FROM students
INNER JOIN courses ON students.student_id = courses.student_id;
Structure-

• Left join-
SELECT *
FROM students
LEFT JOIN courses ON students.student_id = courses.student_id;

Page 14 of 48
KOMAL SINGH| Roll No. 2204340140035

Structure-

• Right Join-
SELECT *
FROM students
RIGHT JOIN courses ON students.student_id = courses.student_id;
Structure-

• Full Join-
SELECT *
FROM students
LEFT JOIN courses ON students.student_id = courses.student_id
UNION ALL
SELECT *
FROM students
RIGHT JOIN courses ON students.student_id = courses.student_id
WHERE students.student_id IS NULL;

Page 15 of 48
KOMAL SINGH| Roll No. 2204340140035

Structure-

c) Perform aggregation functions (e.g., Min, Max, count, sum, average) on a


table.
Table -

Min -
Select e_name,salary from emp where salary = (select min (salary )from emp);

OUTPUT:

Max-
Select e_name ,salary from emp where salary =(select max (salary ) from emp);

Page 16 of 48
KOMAL SINGH| Roll No. 2204340140035

OUTPUT:

Count-
Select count (salary) from emp;
OUTPUT:

Sum-
Select sum(salary) from emp;
OUTPUT:

Average –
select avg(salary) from emp;
OUTPUT:

Page 17 of 48
KOMAL SINGH| Roll No. 2204340140035

7. Discuss the concept of database transactions and the ACID properties.


A database is used by many users and processes at the same time as it is a shared
resource. The IRCTC website is used at the same time by millions of users. Many
people are concurrently booking tickets but how is such a large database always
consistent. The transactions that we do on such websites are concurrently
managed. There are various properties through which the transactions occurring in
the database are managed. These properties are the ACID properties. So, in this
blog, we will see all these properties and the states of the transaction in detail. So,
let's get started.

Transaction
A transaction is a single logical unit of work formed by a set of operations. the
operations which are between the beginning and the end of the transaction are
counted as a single logical unit. The database is inconsistent during the transaction.
It goes into a consistent state only when the transaction has occurred successfully.
It is very important to have a successful transaction.

For example , if you are sending $100 from your account to your friend's account,
then the money deducted from your account should be reflected to your friend's
account.

States Of Transaction
A transaction goes through any different states throughout its lifecycle. These
states also known as transaction state are as follows:

1. Active State: This is the first state of the transaction and any transaction which is
being executed is in this state. The changes made are stored in the buffer in the
main memory.
2. Partially Committed: After the last operation is executed the transaction enters
into the partially committed state. This is said partially committed because the
changes made are still in the buffer in the main memory.
3. Failed State: A transaction enters into the failed state if some checks fail in the
active state, some error occurs in the active or partially committed state and the
transaction cannot be executed further.
4. Aborted State: If any transaction has reached the failed state then the recovery
manager rollback the database to its original state from where the execution had
started.
5. Committed State: A transaction from the partially committed state enters into the
committed state if all the operations are executed successfully. It is not possible to
rollback from this state and it is a new consistent state.

Page 18 of 48
KOMAL SINGH| Roll No. 2204340140035

ACID Properties
For maintaining the integrity of data in the database the certain properties are
followed by all the transactions that take place in the database. These properties are
popularly known as ACID properties where A is for Atomicity, C for Consistency, I
for Isolation and D for Durability.

❖ Atomicity-

This property states that the transaction should either occur completely or doesn't
occur at all. The transaction should not occur partially. Each transaction is treated
as a unit and the execution is completed else the transaction is aborted. If any
transaction is aborted all the changes made are reversed back. If the transaction
occurs completely then only it is committed.

Example: Suppose there are two accounts A and B having a balance of Rs 1000 and
Rs 500 respectively. Now, if you have to transfer Rs 200 from Account A to Account
B then this transaction involves two operations . First, debiting Rs 200 from
Account A and second, crediting Rs 200 to Account B.
Now, let's consider a situation where the first operation has occurred successfully
i.e. Rs 200 was debited from Account A and the balance in Account A is now Rs 800.
But, the second transaction failed . So, the Rs 200 was not added to Account B. This
can lead to inconsistency in the database. So, either the transaction should fail or
both the operations should occur if the transaction has to be successful. The
atomicity thus helps in ensuring the correctness of the database.

Page 19 of 48
KOMAL SINGH| Roll No. 2204340140035

❖ Consistency-
This property ensures that the integrity of the database is maintained before and
after the transaction. It ensures that when any transaction is executed then the
database should move from one consistent state to another consistent state.

Example: In the above example, Account A and Account B have Rs 1000 and Rs 500
respectively. So, the total amount is Rs 1000+ Rs 500 i.e. Rs 1500 before the
transaction. When any transaction is executed then the total amount should also be
Rs 1500. If the transaction occurs then Rs 200 will be deducted from Account A and
added to Account B. So, the total amount after the transaction will Rs 800 + Rs 700
i.e. Rs 1500 . So, this property ensures the consistency of the database. If any
operation in the transaction fails it will produce inconsistency in the data.

❖ Isolation-
This property tells that each transaction is executed in the system such that it is the
only transaction in the system. If more than one transaction is taking place in
parallel, then the occurrence of one transaction will not affect the other transaction.
If any transaction is using a data item then it can’t be used by other transactions
until the first transaction ends.

Example: Suppose we have two transaction T1 and T2 which is defined as follows.


Transaction 1: T1
BEGIN
Read(X)
X=X+50
Write(X)
Read(Y)
Y=Y-10
Write(Y)
END
Transaction 2: T2
BEGIN
Read(X)
Read(Y)
Z=X*Y
Write(Z)
END
Let X = 40, Y = 20.

Now, consider a situation where T1 has been executed until Read(Y) and then T2
starts. Due to this, the transaction T2 reads the incorrect value of Y . It reads the

Page 20 of 48
KOMAL SINGH| Roll No. 2204340140035

value as 20 and the operations which it should have been performed by taking the
value as 10, T2 will perform by taking the value as 20. This leads to inconsistent
results. The output of the transaction T2 should have been X*Y i.e. 90*10(=900) but
it will produce the output as 90*20 i.e. 1800 as T2 has read the incorrect value of Y.
This problem happened because of the transaction result of T1 was made available
for T2. So to avoid any such problem the transactions take place in isolation.

❖ Durability -
This property ensures that once the changes are made in the database these
changes persist in the database even if any system failure occurs. These changes are
saved permanently in the non-volatile memory. It is the responsibility of the
recovery manager to ensure the durability in the database.

Page 21 of 48
KOMAL SINGH| Roll No. 2204340140035

8. Describe the different types of database constraints (e.g., unique, foreign key)
and their purposes.
Constraints are rules and regulations that are enforced on the data. They are used to
validate data. It specifies conditions that the data must satisfy.
SQL constraints are used to specify rules for the data in a table. They are used to
limit the type of data that can be stored in a particular column of a table. Constraints
ensure that the data stored is valid. This ensures the accuracy and reliability of the
data in the database.

Constraints could be either at the column level or at the table level. Column level
constraints are applied only to one column, whereas table level constraints are
applied to the entire table.

Types of SQL Constraints:


➢ NOT NULL
➢ UNIQUE
➢ PRIMARY KEY
➢ FOREIGN KEY
➢ CHECK
➢ DEFAULT

• NOT NULL Constraint-

By default, a column can hold NULL values. If we don't enter any value in a particular
column, it will store NULL if the default value has not been specified. The NULL value
is omitted in various operations in a database. To ensure that a column does not
contain a NULL value, NOT NULL constraint is used.

NOT NULL constraint applied to a column ensures that the particular column always
contains a value, i.e., we cannot insert a new record, or update a record without
providing a value for that field.
A NULL is not the same as no data, blank, or a zero-length character string such as ‘ ’,
rather, it represents unknown data or that no data entry has been made.

For example:
CREATE TABLE E1(
Id INT NOT NULL,
Name VARCHAR(10),
Gender VARCHAR(10)
);

Page 22 of 48
KOMAL SINGH| Roll No. 2204340140035

OUTPUT:

This query will create a table Employees with fields Id, Name, and Gender. Id is
specified with NOT NULL constraint that means they cannot contain NULL value
while Name and Gender may contain NULL value.

If E1 table has already been created, then to add a NOT NULL constraint to the Id
and Name column use following syntax:
ALTER TABLE E1 MODIFY Id INT(3) NOT NULL;
OR
ALTER TABLE E1 ADD [CONSTRAINT notNullE11] NOT NULL(Id);

INSERT INTO E1(Id,Name)VALUES(001,”John Doe”);


This statement will store values in specified fields and store NULL in salary field. As
Salary field does not have a NOT NULL constraint, thus no error will be generated.

INSERT INTO E1(Id,Gender)VALUES(007,’Male’);


This statemnt will store NULL in Name as no value has been assigned to it. But Name
field has a NOT NULL constraint thus an error will be generated as NULL value
cannot be assigned in Name.

• UNIQUE Constraint

UNIQUE constraint ensures that all the values stored in a column are different from
each other. The UNIQUE Constraint prevents two records from having identical
values in a column, i.e., the values must not be repeated.
We can use UNIQUE constraint in a single column or multiple columns.
UNIQUE constraint allows columns to have NULL values.

For example:
CREATE TABLE E5(
Id INT,

Page 23 of 48
KOMAL SINGH| Roll No. 2204340140035

Name VARCHAR(10),
E_MAIL VARCHAR(10) UNIQUE
);

OUTPUT:

This query will create a table E5(Id, Name and E_Mail). The Id has a UNIQUE
constraint thus each row of Id field will have a different value.

If the E5 table has already been created, then to add a UNIQUE constraint to the Id
column:
ALTER TABLE E5 MODIFY Id INT(3) UNIQUE;
OR
ALTER TABLE E5 ADD [CONSTRAINT myUniqueConstraint] UNIQUE(Id);

To drop a UNIQUE constraint, use the following SQL query:


ALTER TABLE E5 DROP [UNIQUE Id | CONSTRAINT myUniqueConstraint];

• PRIMARY KEY Constraint-

A primary key constraint uniquely identifies each row/record in a database table.


Primary keys must contain unique values. A primary key column cannot have NULL
values.
A table can have only one primary key, which may consist of single or multiple fields.
When multiple fields are used as a primary key, they are called a composite key.
The field with a PRIMARY KEY constraint can be used to uniquely identify each
record of a table in various database operations.

For example:
CREATE TABLE E7(
Roll INT(3) PRIMARY KEY,
Name VARCHAR(30),

Page 24 of 48
KOMAL SINGH| Roll No. 2204340140035

AGE INT
);

OUTPUT:

This query will create a table E7(Roll, Name and Age) with Roll field as PRIMARY KEY
constraint.

To create a PRIMARY KEY constraint on the “Roll” column when E7 table already
exists, use the following SQL syntax:
ALTER TABLE E7 MODIFY Roll INT(3) PRIMARY KEY;
OR
ALTER TABLE E7 ADD [CONSTRAINT PK_Roll] PRIMARY KEY(Roll);

To drop PRIMARY KEY Constraints from a table :


ALTER TABLE E7 DROP [PRIMARY KEY | CONSTRAINT PK_Roll];

• FOREIGN KEY Constraint

Foreign Key Constraint is used to link two tables. It is used to establish a relationship
between the data in two tables.
A Foreign Key is a column or a combination of columns whose values match a
Primary Key in a different table. The table containing the FOREIGN KEY is called the
child table, and the table containing the candidate key is called the parent table.
FOREIGN KEY is used to enforce referential integrity. It is used to prevent actions
that would destroy links between tables. It also prevents invalid data from being
inserted into the foreign key column, because it has to be one of the values
contained in the table it points to.

For example:
CREATE TABLE E7(
Roll INT(3) PRIMARY KEY,

Page 25 of 48
KOMAL SINGH| Roll No. 2204340140035

Name VARCHAR(30),
AGE int
);
OUTPUT:

This query creates a table E7(Roll, Name and Mail) with Mail as FOREIGN KEY which
links Employees table to Department table.

To create a FOREIGN KEY constraint on the “Mail” column when Employees table
already exists, use the following SQL syntax:

ALTER table E7 add FOREIGN KEY(roll) REFERENCES E4(roll);

To drop FOREIGN KEY Constraints from a table :


ALTER TABLE E4 DROP [FOREIGN KEY Mail | CONSTRAINT fKey];

• CHECK Constraint

CHECK constraint is used to limit the value range that can be placed in a column.
Using check constraint, we can specify conditions for a field, which will be evaluated
at the time of entering the data to a column. If the condition evaluates to false, the
record violates the constraints and it will not be entered in the table.
If we define a CHECK constraint on a single column it allows only certain values for
this column.
If we define a CHECK constraint on a table it can limit the values in certain columns
based on values in other columns in the row.

For example:
CREATE TABLE F5(
ROLL INT(3) PRIMARY KEY,
Name VARCHAR(30),
AGE INT CHECK(Age >18)
);

Page 26 of 48
KOMAL SINGH| Roll No. 2204340140035

OUTPUT:

This query will create a table F5(Roll,Name and Age).CHECK Constraint has been
applied on Age field, thus at the time of entering data into the table, this constraint
will be evaluated,if it return false the data will not be entered.

To create a CHECK constraint on the Salary column when Employees table already
exists, use the following SQL syntax:
ALTER TABLE F5 ADD [CONSTRAINT CHK_Age] CHECK(Age >18);

To drop a CHECK constraint, use the following SQL:


ALTER TABLE F5 DROP [CONSTRAINT CHK_Age | CHECK Age];

• DEFAULT Constraint-

DEFAULT constraint is used to provide a default value for the fields of a table. That
is, if at the time of entering new records in the table if the user does not specify any
value for these fields then the default value will be assigned to them. The user needs
to define these default values.

For example:
CREATE TABLE F8(
ROLL INT(3) PRIMARY KEY,
Name VARCHAR(30),
AGE INT DEFAULT 18
);
OUTPUT:

Page 27 of 48
KOMAL SINGH| Roll No. 2204340140035

This query will create a table F8(Roll, Name, Age) with DEFAULT Constraint applied
to Age field, thus if no value is entered into Salary field, it will automatically store
the default value i.e. 18.

To create a DEFAULT constraint on the Age column when F8 table already exists, use
the following SQL syntax:
ALTER TABLE F8 ADD CONSTRAINT CHK_Age DEFAULT 18 FOR Age;
OR
ALTER TABLE F8 ALTER Age SET DEFAULT 18;

To drop a DEFAULT constraint, use the following SQL:


ALTER TABLE F8 ALTER Age DROP DEFAULT;

Page 28 of 48
KOMAL SINGH| Roll No. 2204340140035

9.What is ER diagram and describe its components.

An Entity Relationship Diagram is a diagram that represents relationships among


entities in a database. It is commonly known as an ER Diagram. An ER Diagram
in DBMS plays a crucial role in designing the database. Today’s business world
previews all the requirements demanded by the users in the form of an ER Diagram.
Later, it's forwarded to the database administrators to design the database.

What is an ER Diagram?

An Entity Relationship Diagram (ER Diagram) pictorially explains the relationship


between entities to be stored in a database. Fundamentally, the ER Diagram is a
structural design of the database. It acts as a framework created with specialized
symbols for the purpose of defining the relationship between the database entities.
ER diagram is created based on three principal components: entities, attributes, and
relationships.

The following diagram showcases two entities - Student and Course, and their
relationship. The relationship described between student and course is many-to-

Page 29 of 48
KOMAL SINGH| Roll No. 2204340140035

many, as a course can be opted by several students, and a student can opt for more
than one course. Student entity possesses attributes - Stu_Id, Stu_Name & Stu_Age.
The course entity has attributes such as Cou_ID & Cou_Name.

What is an ER Model?

An Entity-Relationship Model represents the structure of the database with the help
of a diagram. ER Modelling is a systematic process to design a database as it would
require you to analyze all data requirements before implementing your database.

Why Use ER Diagrams in DBMS?

• ER Diagram helps you conceptualize the database and lets you know which
fields need to be embedded for a particular entity

• ER Diagram gives a better understanding of the information to be stored in


a database

• It reduces complexity and allows database designers to build databases


quickly

• It helps to describe elements using Entity-Relationship models

• It allows users to get a preview of the logical structure of the database.

Symbols Used in ER Diagrams

• Rectangles: This Entity Relationship Diagram symbol represents entity types

• Ellipses: This symbol represents attributes

• Diamonds: This symbol represents relationship types

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

• Primary key: Here, it underlines the attributes

• Double Ellipses: Represents multi-valued attributes

Page 30 of 48
KOMAL SINGH| Roll No. 2204340140035

Components of ER Diagram
You base an ER Diagram on three basic concepts:

• Entities
• Weak Entity
• Attributes
• Key Attribute
• Composite Attribute
• Multivalued Attribute
• Derived Attribute
• Relationships
• One-to-One Relationships
• One-to-Many Relationships
• Many-to-One Relationships
• Many-to-Many Relationships

Entities

• An entity can be either a living or non-living component.


• It showcases an entity as a rectangle in an ER diagram.
For example, in a student study course, both the student and the course are entities.

Page 31 of 48
KOMAL SINGH| Roll No. 2204340140035

Weak Entity

An entity that makes reliance over another entity is called a weak entity
You showcase the weak entity as a double rectangle in ER Diagram.
In the example below, school is a strong entity because it has a primary key attribute
- school number. Unlike school, the classroom is a weak entity because it does not
have any primary key and the room number here acts only as a discriminator.

Attribute
An attribute exhibits the properties of an entity.
You can illustrate an attribute with an oval shape in an ER diagram.

Page 32 of 48
KOMAL SINGH| Roll No. 2204340140035

Key Attribute

Key attribute uniquely identifies an entity from an entity set.


It underlines the text of a key attribute.
For example: For a student entity, the roll number can uniquely identify a student
from a set of students.

Composite Attribute

An attribute that is composed of several other attributes is known as a composite


attribute.
An oval showcases the composite attribute, and the composite attribute oval is
further connected with other ovals.

Multivalued Attribute

Some attributes can possess over one value, those attributes are called multivalued
attributes.
The double oval shape is used to represent a multivalued attribute.

Page 33 of 48
KOMAL SINGH| Roll No. 2204340140035

Derived Attribute

An attribute that can be derived from other attributes of the entity is known as a
derived attribute.
In the ER diagram, the dashed oval represents the derived attribute.

Relationship

The diamond shape showcases a relationship in the ER diagram.


It depicts the relationship between two entities.
In the example below, both the student and the course are entities, and study is the
relationship between them.

Page 34 of 48
KOMAL SINGH| Roll No. 2204340140035

One-to-One Relationship

When a single element of an entity is associated with a single element of another


entity, it is called a one-to-one relationship.
For example, a student has only one identification card and an identification card is
given to one person.

One-to-Many Relationship

When a single element of an entity is associated with more than one element of
another entity, it is called a one-to-many relationship
For example, a customer can place many orders, but an order cannot be placed by
many customers.

Many-to-One Relationship

When more than one element of an entity is related to a single element of another
entity, then it is called a many-to-one relationship.
For example, students have to opt for a single course, but a course can have many
students.

Page 35 of 48
KOMAL SINGH| Roll No. 2204340140035

Many-to-Many Relationship

When more than one element of an entity is associated with more than one element
of another entity, this is called a many-to-many relationship.
For example, you can assign an employee to many projects and a project can have
many employees.

Page 36 of 48
KOMAL SINGH| Roll No. 2204340140035

10.What are Keys in DBMS?


KEYS in DBMS is an attribute or set of attributes which helps you to identify a
row(tuple) in a relation(table). They allow you to find the relation between two
tables. Keys help you uniquely identify a row in a table by a combination of one or
more columns in that table. Key is also helpful for finding unique record or row from
the table. Database key is also helpful for finding unique record or row from the
table.
Example:

Employee ID FirstName LastName

11 Aakash Mishra

22 Hritik Singh

33 Rishabh Pandey

In the above-given example, employee ID is a primary key because it uniquely


identifies an employee record. In this table, no other employee can have the same
employee ID.

Why we need a Key?


Here are some reasons for using sql key in the DBMS system.

• Keys help you to identify any row of data in a table. In a real-world


application, a table could contain thousands of records. Moreover, the records
could be duplicated. Keys in RDBMS ensure that you can uniquely identify a
table record despite these challenges.
• Allows you to establish a relationship between and identify the relation
between tables
• Help you to enforce identity and integrity in the relationship.

Types of Keys in DBMS (Database Management System)


There are mainly Eight different types of Keys in DBMS and each key has it’s different
functionality:

1. Super Key
2. Primary Key
3. Candidate Key
4. Alternate Key
5. Foreign Key

Page 37 of 48
KOMAL SINGH| Roll No. 2204340140035

6. Compound Key
7. Composite Key
8. Surrogate Key

Let’s look at each of the keys in DBMS with example:

• Super Key – A super key is a group of single or multiple keys which identifies
rows in a table.
• Primary Key – is a column or group of columns in a table that uniquely identify
every row in that table.
• Candidate Key – is a set of attributes that uniquely identify tuples in a table.
Candidate Key is a super key with no repeated attributes.
• Alternate Key – is a column or group of columns in a table that uniquely
identify every row in that table.
• Foreign Key – is a column that creates a relationship between two tables. The
purpose of Foreign keys is to maintain data integrity and allow navigation
between two different instances of an entity.
• Compound Key – has two or more attributes that allow you to uniquely
recognize a specific record. It is possible that each column may not be unique
by itself within the database.
• Composite Key – is a combination of two or more columns that uniquely
identify rows in a table. The combination of columns guarantees uniqueness,
though individual uniqueness is not guaranteed.
• Surrogate Key – An artificial key which aims to uniquely identify each record is
called a surrogate key. These kind of key are unique because they are created
when you don’t have any natural primary key.

What is the Super key?


A super key is a group of single or multiple keys which identifies rows in a table. A
Super key may have additional attributes that are not needed for unique
identification.

Example:

EmpSSN EmpNum Empname

9812345098 AB05 Aakash

9876512345 AB06 Hritik

199937890 AB07 Rishabh


In the above-given example, EmpSSN and EmpNum name are superkeys.

Page 38 of 48
KOMAL SINGH| Roll No. 2204340140035

What is a Primary Key?


PRIMARY KEY in DBMS is a column or group of columns in a table that uniquely
identify every row in that table. The Primary Key can’t be a duplicate meaning the
same value can’t appear more than once in the table. A table cannot have more than
one primary key.
Rules for defining Primary key:

• Two rows can’t have the same primary key value


• It must for every row to have a primary key value.
• The primary key field cannot be null.
• The value in a primary key column can never be modified or updated if any
foreign key refers to that primary key.

Example:

In the following example, <code>StudID</code> is a Primary Key.

StudID Roll No First Name LastName Email

1 11 Aakash Mishra abc@gmail.com

2 12 Hritik Singh xyz@gmail.com

3 13 Rishabh Pandey mno@yahoo.com

What is the Alternate key?


ALTERNATE KEYS is a column or group of columns in a table that uniquely identify
every row in that table. A table can have multiple choices for a primary key but only
one can be set as the primary key. All the keys which are not primary key are called
an Alternate Key.
Example:

In this table, StudID, Roll No, Email are qualified to become a primary key. But since
StudID is the primary key, Roll No, Email becomes the alternative key.

StudID Roll No First Name LastName Email

1 11 Aakash Mishra abc@gmail.com

2 12 Hritik Singh xyz@gmail.com

3 13 Rishabh Pandey mno@yahoo.com

Page 39 of 48
KOMAL SINGH| Roll No. 2204340140035

What is a Candidate Key?


CANDIDATE KEY in SQL is a set of attributes that uniquely identify tuples in a table.
Candidate Key is a super key with no repeated attributes. The Primary key should be
selected from the candidate keys. Every table must have at least a single candidate
key. A table can have multiple candidate keys but only a single primary key.

Properties of Candidate key:

• It must contain unique values


• Candidate key in SQL may have multiple attributes
• Must not contain null values
• It should contain minimum fields to ensure uniqueness
• Uniquely identify each record in a table

Candidate key Example: In the given table Stud ID, Roll No, and email are candidate
keys which help us to uniquely identify the student record in the table.

StudID Roll No First Name LastName Email

1 11 Aakash Mishra abc@gmail.com

2 12 Hritik Singh xyz@gmail.com

3 13 Rishabh Pandey mno@yahoo.com

Candidate Key in DBMS

What is the Foreign key?


FOREIGN KEY is a column that creates a relationship between two tables. The
purpose of Foreign keys is to maintain data integrity and allow navigation between
two different instances of an entity. It acts as a cross-reference between two tables
as it references the primary key of another table.

Page 40 of 48
KOMAL SINGH| Roll No. 2204340140035

Example:

DeptCode DeptName

001 Science

002 English

005 Computer

Teacher ID Fname Lname

B002 Aakash Mishra

B017 Hritik Singh

B009 Rishabh Pandey

In this key in dbms example, we have two table, teach and department in a school.
However, there is no way to see which search work in which department.

In this table, adding the foreign key in Deptcode to the Teacher name, we can create
a relationship between the two tables.

Teacher ID DeptCode Fname Lname

B002 002 Aakash Mishra

B017 002 Hritik Singh

B009 001 Rishabh Pandey


This concept is also known as Referential Integrity.

What is the Compound key?

COMPOUND KEY has two or more attributes that allow you to uniquely recognize a
specific record. It is possible that each column may not be unique by itself within the
database. However, when combined with the other column or columns the
combination of composite keys become unique. The purpose of the compound key in
database is to uniquely identify each record in the table.

Example:

Page 41 of 48
KOMAL SINGH| Roll No. 2204340140035

OrderNo PorductID Product Name Quantity

B005 JAP102459 Mouse 5

B005 DKT321573 USB 10

B005 OMG446789 LCD Monitor 20

B004 DKT321573 USB 15

B002 OMG446789 Laser Printer 3


In this example, OrderNo and ProductID can’t be a primary key as it does not
uniquely identify a record. However, a compound key of Order ID and Product ID
could be used as it uniquely identified each record.

What is the Composite key?


COMPOSITE KEY is a combination of two or more columns that uniquely identify
rows in a table. The combination of columns guarantees uniqueness, though
individually uniqueness is not guaranteed. Hence, they are combined to uniquely
identify records in a table.
The difference between compound and the composite key is that any part of the
compound key can be a foreign key, but the composite key may or maybe not a part
of the foreign key.

What is a Surrogate key?


SURROGATE KEYS is An artificial key which aims to uniquely identify each record is
called a surrogate key. This kind of partial key in dbms is unique because it is created
when you don’t have any natural primary key. They do not lend any meaning to the
data in the table. Surrogate key in DBMS is usually an integer. A surrogate key is a
value generated right before the record is inserted into a table.
Fname Lastname Start Time End Time

Aakash Mishra 09:00 18:00

Hritik Singh 08:00 17:00

Rishabh Pandey 11:00 20:00

Elvish Yadav 14:00 23:00


Above, given example, shown shift timings of the different employee. In this
example, a surrogate key is needed to uniquely identify each employee.

Page 42 of 48
KOMAL SINGH| Roll No. 2204340140035

Surrogate keys in sql are allowed when

• No property has the parameter of the primary key.


• In the table when the primary key is too big or complicated.

Difference Between Primary key & Foreign key


Following is the main difference between primary key and foreign key:

Primary Key Foreign Key

o Helps you to uniquely identify a o It is a field in the table that is the


record in the table. primary key of another table.

o Primary Key never accept null o A foreign key may accept multiple null
values. values.

o Primary key is a clustered index o A foreign key cannot automatically


and data in the DBMS table are create an index, clustered or non-
physically organized in the clustered. However, you can manually
sequence of the clustered index. create an index on the foreign key.

o You can have the single Primary o You can have multiple foreign keys in a
key in a table. table.

Page 43 of 48
KOMAL SINGH| Roll No. 2204340140035

11.What is Functional Dependency?


Functional Dependency (FD) is a constraint that determines the relation of one
attribute to another attribute in a Database Management System (DBMS). Functional
Dependency helps to maintain the quality of data in the database. It plays a vital role
to find the difference between good and bad database design.
A functional dependency is denoted by an arrow “→”. The functional dependency of
X on Y is represented by X → Y. Let’s understand Functional Dependency in DBMS
with example.

Example:

Employee number Employee Name Salary City

1 Hritik 50000 Lucknow

2 Rishabh 38000 Varanasi

3 Elvish 25000 Ayodhya

Here, are some key terms for Functional Dependency in Database:

Key Terms Description

Axioms is a set of inference rules used to infer all the functional


• Axiom
dependencies on a relational database.

It is a rule that suggests if you have a table that appears to contain


• Decomposition two entities which are determined by the same primary key then
you should consider breaking them up into two different tables.

It is displayed on the right side of the functional dependency


• Dependent
diagram.

It is displayed on the left side of the functional dependency


• Determinant
Diagram.

It suggests that if two tables are separate, and the PK is the same,
• Union
you should consider putting them. together

Rules of Functional Dependencies


Below are the Three most important rules for Functional Dependency in Database:

Page 44 of 48
KOMAL SINGH| Roll No. 2204340140035

• Reflexive rule –. If X is a set of attributes and Y is_subset_of X, then X holds a


value of Y.
• Augmentation rule: When x -> y holds, and c is attribute set, then ac -> bc also
holds. That is adding attributes which do not change the basic dependencies.
• Transitivity rule: This rule is very much similar to the transitive rule in algebra
if x -> y holds and y -> z holds, then x -> z also holds. X -> y is called as
functionally that determines y.

Types of Functional Dependencies in DBMS


There are mainly four types of Functional Dependency in DBMS. Following are the
types of Functional Dependencies in DBMS:

• Multivalued Dependency
• Trivial Functional Dependency
• Non-Trivial Functional Dependency
• Transitive Dependency

Multivalued Dependency in DBMS-


Multivalued dependency occurs in the situation where there are multiple
independent multivalued attributes in a single table. A multivalued dependency is a
complete constraint between two sets of attributes in a relation. It requires that
certain tuples be present in a relation. Consider the following Multivalued
Dependency Example to understand.

Example:
Car_model Maf_year Color

H001 2017 Metallic

H001 2017 Green

H005 2018 Metallic

H005 2018 Blue

H010 2015 Metallic

H033 2012 Gray


In this example, maf_year and color are independent of each other but dependent
on car_model. In this example, these two columns are said to be multivalue
dependent on car_model.

Page 45 of 48
KOMAL SINGH| Roll No. 2204340140035

This dependence can be represented like this:

car_model -> maf_year

car_model-> colour

Trivial Functional Dependency in DBMS


The Trivial dependency is a set of attributes which are called a trivial if the set of
attributes are included in that attribute.

So, X -> Y is a trivial functional dependency if Y is a subset of X. Let’s understand with


a Trivial Functional Dependency Example.

For example:

Emp_id Emp_name

AS555 Hritik

AS811 Rishabh

AS999 Elvish
Consider this table of with two columns Emp_id and Emp_name.

{Emp_id, Emp_name} -> Emp_id is a trivial functional dependency as Emp_id is a


subset of {Emp_id,Emp_name}.

Non Trivial Functional Dependency in DBMS


Functional dependency which also known as a nontrivial dependency occurs when A-
>B holds true where B is not a subset of A. In a relationship, if attribute B is not a
subset of attribute A, then it is considered as a non-trivial dependency.

Company CEO

Microsoft Satya Nadella

Google Sundar Pichai

Apple Tim Cook


Example:
(Company} -> {CEO} (if we know the Company, we knows the CEO name)
But CEO is not a subset of Company, and hence it’s non-trivial functional
dependency.

Page 46 of 48
KOMAL SINGH| Roll No. 2204340140035

Transitive Dependency in DBMS-


A Transitive Dependency is a type of functional dependency which happens when “t”
is indirectly formed by two functional dependencies. Let’s understand with the
following Transitive Dependency Example.

Example:

Company CEO

Microsoft Satya Nadella

Google Sundar Pichai

Alibaba Jack Ma
{Company} -> {CEO} (if we know the compay, we know its CEO’s name)

{CEO } -> {Age} If we know the CEO, we know the Age

Therefore according to the rule of rule of transitive dependency:

{ Company} -> {Age} should hold, that makes sense because if we know the company
name, we can know his age.

Note: You need to remember that transitive dependency can only occur in a relation
of three or more attributes.

What is Normalization?
Normalization is a method of organizing the data in the database which helps you to
avoid data redundancy, insertion, update & deletion anomaly. It is a process of
analyzing the relation schemas based on their different functional dependencies and
primary key.

Normalization is inherent to relational database theory. It may have the effect of


duplicating the same data within the database which may result in the creation of
additional tables.

Advantages of Functional Dependency

• Functional Dependency avoids data redundancy. Therefore same data do not


repeat at multiple locations in that database
• It helps you to maintain the quality of data in the database
• It helps you to defined meanings and constraints of databases

Page 47 of 48
KOMAL SINGH| Roll No. 2204340140035

• It helps you to identify bad designs


• It helps you to find the facts regarding the database design

Page 48 of 48

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy