Module 1: Introduction & Entity Relationship (ER) Model
Introduction to DBMS
A Database Management System (DBMS) is a software system designed to store, manage, and facilitate access to databases. It serves as an intermediary between the user and the database, ensuring that the data is organized, consistent, and easily accessible.
Example: Consider a library management system. A DBMS in this context would manage data about books, borrowers, and loans, allowing librarians to easily track which books are checked out and by whom.
Characteristics of Database Systems
Database systems are characterized by their ability to ensure data integrity, support for concurrent user access, provision of security measures, and data independence.
Example: In a banking system, the DBMS ensures that two customers cannot withdraw the same amount from an account simultaneously, preserving the integrity of account balances.
Database Users
Database users can be categorized into several types, including:
- Administrators: Responsible for managing and maintaining the database system.
- Developers: Use the DBMS to create applications that interact with the database.
- End-users: Interact with the database through front-end applications.
Example: In a company, the HR manager (end-user) might use a system developed by the IT team (developers) to access employee records stored in a database overseen by the database administrator (administrator).
Types of Data
- Structured Data: Highly organized data that fits into predefined models like tables.
- Semi-structured Data: Data that does not conform to rigid structures but has some organizational properties, like XML or JSON.
- Unstructured Data: Data with no predefined format, such as images, videos, and emails.
Example: An e-commerce platform stores product information (structured), customer reviews (semi-structured), and product images (unstructured).
Data Models and Schema
- Data Models: Frameworks that define how data is connected and how it is stored and accessed. Common models include the conceptual, physical, and logical models.
- Three Schema Architecture: A way to separate the database system into three levels: internal (physical storage), conceptual (logical structure), and external (user views).
Example: A university database might have a conceptual schema defining entities like Students and Courses, while the physical schema details how this information is stored on disk.
Database Languages and Architectures
- Languages: SQL is the standard language used to interact with relational databases, while PL/SQL is an extension of SQL that includes procedural features.
- Architectures: The structure of the database system, which can be client-server, cloud-based, or distributed.
Example: A web application might use a client-server architecture where the client sends SQL queries to a server hosting the DBMS.
Entity Relationship (ER) Model
The ER model is a conceptual tool used to design and model databases. It defines entities (things about which data is stored) and relationships (associations between entities).
Example: In a sales database, “Customer” and “Order” are entities, with a relationship indicating that a customer places an order.
Entity Sets & Attributes
- Entity Sets: Groups of similar entities.
- Attributes: Characteristics or properties of entities.
Example: In a university database, the entity set “Students” might have attributes like student ID, name, and major.
Relationships and Constraints
Relationships define how entities are related to each other, and constraints impose limits on the data.
Example: A “one-to-many” relationship between “Teachers” and “Classes” indicates that one teacher can teach many classes, but each class is taught by only one teacher.
Cardinality and Participation
- Cardinality: Defines the numerical relationships between entities.
- Participation: Specifies whether all instances of an entity are involved in the relationship.
Example: The cardinality between “Authors” and “Books” might be “many-to-many” if authors can write multiple books and books can have multiple authors.
Weak Entities
Weak entities are entities that do not have a primary key and are dependent on another entity.
Example: A “Payment” entity might be weak if it cannot exist without being associated with an “Order” entity.
Relationships of Degree 3
These are ternary relationships that involve three entities.
Example: A “Supplies” relationship might involve “Supplier,” “Product,” and “Store” entities, indicating that a supplier provides a product to a store.