1) DBMS Concepts

DBMS Tutorial Components of DBMS. Applications of DBMS The difference between file system and DBMS. Types of DBMS DBMS Architecture DBMS Schema Three Schema Architecture. DBMS Languages.

2) DBMS ER Model

ER model: Entity Relationship Diagram (ERD) Components of ER Model. DBMS Generalization, Specialization and Aggregation.

3) DBMS Relational Model

Codd’s rule of DBMS Relational DBMS concepts Relational Integrity Constraints DBMS keys Convert ER model into Relational model Difference between DBMS and RDBMS Relational Algebra DBMS Joins

4) DBMS Normalization

Functional Dependency Inference Rules Multivalued Dependency Normalization in DBMS: 1NF, 2NF, 3NF, BCNF and 4NF

5) DBMS Transaction

What is Transaction? States of transaction ACID Properties in DBMS Concurrent execution and its problems DBMS schedule DBMS Serializability Conflict Serializability View Serializability Deadlock in DBMS Concurrency control Protocols

6) Misc

Advantages of DBMS Disadvantages of DBMS Data Models in DBMS Relational Algebra in DBMS Cardinality in DBMS Entity in DBMS Attributes in DBMS Data Independence in DBMS Primary Key in DBMS Foreign Key in DBMS Candidate Key in DBMS Super Key in DBMS Aggregation in DBMS Hashing in DBMS Generalization in DBMS Specialization in DBMS View in DBMS File Organization in DBMS What Is A Cloud Database What Is A Database Levels Of Locking In DBMS What is RDBMS Fragmentation in Distributed DBMS What is Advanced Database Management System Data Abstraction in DBMS Checkpoint In DBMS B Tree in DBMS BCNF in DBMS Advantages of Threaded Binary Tree in DBMS Advantages of Database Management System in DBMS Enforcing Integrity Constraints in DBMS B-Tree Insertion in DBMS B+ Tree in DBMS Advantages of B-Tree in DBMS Types of Data Abstraction in DBMS Levels of Abstraction in DBMS 3- Tier Architecture in DBMS Anomalies in Database Management System Atomicity in Database Management System Characteristics of DBMS DBMS Examples Difference between Relational and Non-Relational Databases Domain Constraints in DBMS Entity and Entity set in DBMS ER Diagram for Banking System in DBMS ER Diagram for Company Database in DBMS ER Diagram for School Management System in DBMS ER Diagram for Student Management System in DBMS ER Diagram for University Database in DBMS ER Diagram of Company Database in DBMS Er Diagram Symbols and Notations in DBMS How to draw ER-Diagram in DBMS Integrity Constraints in DBMS Red-Black Tree Deletion in DBMS Red-Black Tree Properties in DBMS Red-Black Tree Visualization in DBMS Redundancy in Database Management System Secondary Key in DBMS Structure of DBMS 2-Tier Architecture in DBMS Advantages and Disadvantages of Binary Search Tree Closure of Functional Dependency in DBMS Consistency in Database Management System Durability in Database Management System ER Diagram for Bank Management System in DBMS ER Diagram for College Management System in DBMS ER Diagram for Hotel Management System in DBMS ER Diagram for Online Shopping ER Diagram for Railway Reservation System ER Diagram for Student Management System in DBMS Isolation in DBMS Lossless Join and Dependency Preserving Decomposition in DBMS Non-Key Attributes in DBMS

Hashing in DBMS: Static and Dynamic

Hashing in DBMS: Hashing is the technique of the database management system, which directly finds the specific data location on the disk without using the concept of index structure.

In the database systems, data is stored at the blocks whose data address is produced by the hash function. That location of memory where hash files stored these records is called as data bucket or data block.

In this technique, the hash function uses that column, which contains the primary key constraint for generating the address of the data block.

Why is Hashing important?

Following are the various situations when we need to apply hashing in DBMS:

  • When the data in the database is so massive, it is difficult to search all the index values, and then we require to reach the desired data block's destination.
  • Without using the indexing technique, it is an ideal method to find the direct location of the data.
  • This technique is also helpful for implementing dictionaries.

Essential Terms used in Hashing Technique

Following are the various terms or terminologies used in this technique:

  • Bucket Overflow: Bucket overflow is that condition when buckets are filled with the hash result. It is the stage of fatal for any static function.
  • Data Bucket: That location of memory where the hash file stored the records. It is also referred to as a Unit of storage
  • Double Hashing: It is a computer programming method, which is similar to the method of linear probing.
  • Hash function: This mapping function matches all the set of search keys to those addresses where the actual records are located. It is an easy mathematics function.
  • Hash Index: Hash Index is an address of the block of data. It comes from the prefix of the hash value.
  • Key: A key in the Database Management system (DBMS) is a field or set of fields that helps the relational database users to uniquely identify the row/records of the database table.
  • Linear Probing: It is a concept in which the next available block of data is used for inserting the new record instead of overwriting the older data block.
  • Quadratic Probing: It is a method that helps users to determine or find the address of a new data bucket.

Types of Hashing

In the database management system, hashing is mainly categorized into the following two types:

1. Static Hashing

2. Dynamic Hashing

Static Hashing

In this type of hashing, the address of the resultant data bucket always will be the same. Let's take an example; if we want to generate the address for Product_ID = 76 using the mod (5) hash function, it always provides the result in the same bucket address as 3. In memory, the number of data buckets always remains the same or constant.

Operations of Static Hashing

Following are the four operations in the static hashing:

1. Search a Record

2. Insert a Record

3. Delete a Record

4. Update a Record

Search a Record

When we need to search a record, then the same hash function helps us retrieve the bucket's address where the data is stored.

Insert a Record

When we need to insert the new record in the table, the hash function automatically generated the address bucket for the record based on the hash key. 

Delete a Record

When we want to delete the record from the table, we will read or fetch the record, which we want to be deleted using the hash function. And, after that, we have to remove the record for that memory address.

Update a Record

When we want to update the existing record in the table, then, by using the hash function firstly, we have to search the record, which is to be updated. Then the data record is updated automatically.

Following are the two different methods which overcome the problem of bucket overflow situation:

1. Open Hashing

2. Closed Hashing

Open Hashing

In this method of hashing, the next free data block is selected for entering the new record, rather than overwriting the data to the previous block. This mechanism or method is also known as linear probing.  

Example of open hashing: Suppose C2 is a new record that we want to insert, then the hash function generates the address as 301 for the record C2. But the generated address is already full. So, this method searches the next free data bucket, which is 601 and allocates the record C2 to it.

Closed Hashing

In this method of hashing, when the data bucket is filled with data, then the new bucket is selected for the same hash result and is linked with the previously filled bucket. This mechanism is called as Overflow-Chaining.

Example of Closed Hashing: Suppose C3 is a new record, which we want to insert into the table. Then, the static hash function automatically generates the address as 130. But, this data bucket is full and cannot receive new data for storing. So, closed hashing adds the new data bucket at the end of 130 and automatically links it. And, then the new C3 record is entered into the new data bucket.

Dynamic Hashing

This type of hashing is introduced to solve the basic problem of static hashing. The problem of static hashing technique is that it does not reduce or enlarge its size dynamically according to the database size.

In this type of hashing, the data buckets are dynamically added or removed as the records in the database increase or decrease. This type of hashing is also called as extended hashing. The hash function is created for generating a large number of values.