BICTE Dbms Solution
BICTE Dbms Solution
Atomicity:
• By this, we mean that either the entire transaction takes place at once or doesn’t happen at
all. Or It states that all operations of the transaction take place at once if not, the
transaction is aborted.
• Atomicity involves the following two operations:
Abort: If a transaction aborts then all the changes made are not visible.
Commit: If a transaction commits then all the changes made are visible.
Consistency:
• This means that integrity constraints must be maintained so that the database is consistent
before and after the transaction. It refers to the correctness of a database.
Or
Before the transaction starts and after a transaction ends, the sum of money must be equal in both
states.
Isolation:
• This property ensures that multiple transactions can occur simultaneously without causing
any inconsistency. Or
• It shows that the data which is used at the time of execution of a transaction cannot be used
by the second transaction until the first one is completed.
• Durability:
• It means once the transaction is done, and updated in the database it is not going to change
except the user changes or deletes the transaction. Durable means here the transaction is
once done and saved in a database in a hardware form as a permanent change. Committed
data would never be lost, even in hardware failure. It is actually a backup of the database
2. What is Normalization? What are the importance of Normalization? Explain 1NF, 2NF and
3NF with example.
Normalization is the process of organizing the data in the database. Or Normalization is
used to minimize the redundancy from a relation or set of relations. It is also used to
eliminate the undesirable characteristics like Insertion, Update and Deletion Anomalies.
The importance of Normalization are:
✓ It eliminates redundant data.
✓ It reduces chances of data error.
✓ It allows database to take up less disk space.
✓ It also help in increasing the performance.
✓ It improves the data integrity and consistency.
1NF:
A relation will be 1NF if it contains an atomic value. It states that an attribute of a table
cannot hold multiple values. It must hold only single-valued attribute.
For example: Consider relation Employee
Eid Ename Ephone Ecity
2NF:
In the 2NF, relational must be in 1NF. In the second normal form, all non-key attributes are
fully functional dependent on the primary key
Example: Let's assume, MMAM College can store the data of teachers and the subjects
they teach. In a college, a teacher can teach more than one subject
101 C-programming 35
101 Networking 35
102 English 34
103 DBMS 45
103 FIT 45
To convert the given table into 2NF, we decompose it into two tables:
101 C-programming
101 Networking
102 English
103 DBMS
103 FIT
101 35
102 34
103 45
✓ 3NF
A table design is said to be in 3NF if both the following conditions hold:
- Table must be in 2NF
- Transitive functional dependency of non-prime attribute on any super key
should be removed. Or No non-prime attribute is transitively dependent on the
primary key
Example: Suppose a company wants to store the complete address of each employee,
they create a table named employee_details that looks like this
eid ename ezip estate ecity edistrict
1001 Jhon 121 UP Agra D1
1002 Adam 122 UP Agra D2
1003 Alex 123 TN Chennai C1
1004 Peter 345 UK Pauri P1
1005 Pop 567 P1 Brt M1
Here, estate, ecity & edistrict dependent on ezip. And, ezip is dependent on eid that makes
non-prime attributes (estate, ecity & edistrict) transitively dependent on super key
(eid). This violates the rule of 3NF.
Now, to make this table complies with 3NF we have to break the table into two tables to
remove the transitive dependency
Fig: Employee table
UPDATE table-name
SET column-name = value where condition;
✓ UPDATE emp
✓ Example: set salary=salary+(salary*10/100);
UPDATE student
set Sname='Abhi',Age=19
where Sid=103
▪ DELETE Statement: The DELETE statement is used to delete rows or records in a table.
You can use WHERE clause with DELETE query to delete selected rows, otherwise all the
records would be deleted
▪ Syntax:
DELETE FROM table_name
WHERE [condition];
Example:
DELETE FROM employee
WHERE eID = 101;
Compiled by :
LB Gurung
[email protected]