Database Management System is an organized collection of interrelated data that helps in accessing data quickly, along with efficient insertion, and deletion of data into the DBMS. DBMS organizes data in the form of tables, schemas, records, etc.
DBMS over File System
The file system has numerous issues, which were resolved with the help of DBMS, the issues with the file system are:
- Data Redundancy: Same data can be stored at multiple places.
- Data Inconsistency: If multiple copies of the same data have different content in each copy. Like, the phone number of students is different in academic and accounts files.
- Data access: In a file system, accessing data was difficult and insecure as well. Accessing data concurrently was not possible.
- No Backup and Recovery: There is no backup and recovery in the file system that can lead to data loss.
ER-Model
ER Diagram: An ER diagram is a model of a logical view of the database which is represented using the following components:
- Entity: The entity is a real-world object, represented using a rectangular box.
- Strong Entity: A strong entity set has a primary key and all the tuples of the set can be identified using that primary key
- Weak entity: When an entity does not have sufficient attributes to form a primary key. Weak entities are associated with another strong entity set also known as identifying an entity. A weak entity’s existence depends upon the existence of its identifying entity. The weak entity is represented using a double-lined or bold-lined rectangle.
- Attribute: Attribute is the properties or characteristics of the real-world object. It is represented using an oval.
- Key attribute: The attribute which determines each entity uniquely is known as the Key attribute. It is represented by an oval with an underlying line.
- Composite Attribute: An attribute that is composed of many other attributes. E.g. address is an attribute it is formed of other attributes like state, district, city, street, etc. It is represented using an oval comprises of many other ovals.
- Multivalued Attribute: An attribute that can have multiple values, like a mobile number. It is represented using a double-lined oval.
- Derived attribute: An attribute that can be derived from other attributes. E.g. Age is an attribute that can be derived from another attribute Data of Birth. It is represented using a dashed oval.
- Relationship: A relationship is an association between two or more entities. Entities are connected or related to each other and this relationship is represented using a diamond.
Some Important Terms
Cardinality of DBMS: Cardinality of relation expresses the maximum number of possible relationship occurrences for an entity participating in a relationship. Cardinality of a relationship can be defined as the number of times an entity of an entity set participates in a relationship set. Let’s suppose a binary relationship R between two entity sets A and B. The relationship must have one of the following mapping cardinalities:
- One-to-One: When one entity of A is related to at most one entity of B, and vice-versa.
- One-to-Many: When one entity of A is related to one or more than one entity of B. Whereas B is associated with at most one entity in A.
- Many-to-One: When one entity of B is related to one or more than one entity of A. Whereas A is associated with at most one entity in B.
- Many-to-Many: Any number of entities of A is related to any number of entities of B, and vice-versa.
The most commonly asked question in ER diagram is the minimum number of tables required for a given ER diagram. Generally, the following criteria are used:
Cardinality |
Minimum No. of tables |
1:1 cardinality with partial participation of both entities |
2 |
1:1 cardinality with a total participation of at least 1 entity |
1 |
1:n cardinality |
2 |
m:n cardinality |
3 |