Core Database Concepts Explained
Data vs. Information
Data is raw facts, like numbers, words, or pictures. It is not organized or processed. Example: A list of student names, ages, and grades.
Information is data that has been processed to be useful and meaningful. Example: If we calculate the average grade of a class, that is information.
Difference
- Data is raw, while information is processed and meaningful.
- Data alone may not be useful, but information helps us understand and make decisions.
Database vs. Traditional File System
Database: A database is a structured way to store and manage data. It helps us find, update, and organize data easily.
Traditional File System: A file system stores data in files and folders on a computer. It is simple but less efficient for large data.
Difference
- Databases use tables, while file systems use folders and files.
- Databases check and keep data correct, but file systems do not.
- Databases handle large amounts of data better.
- Databases have stronger security than file systems.
Centralized vs. Distributed Database
Centralized Database: A centralized database keeps all data in one place (like a single server). It is controlled by one main system, making it easy to manage. But if the server fails, the whole system may stop working.
Distributed Database: A distributed database spreads data in different locations (like multiple servers). This makes it faster, more reliable, and available even if one part fails. However, it is harder to manage because data needs to be kept in sync.
Advantages of DBMS
- Data is stored separately from applications, so changing the data structure won’t affect the programs using it.
- DBMS makes sure data is accurate and consistent by following rules.
- Many users can use the database at the same time without problems.
- DBMS has strong security, such as user login and access control.
- DBMS can automatically save and restore data if lost.
- DBMS reduces duplicate data, keeping storage efficient.
Database System Components
Hardware
Servers: Computers that store and manage the database.
Storage Devices: Hard drives and SSDs to keep data safe.
Network: Helps computers connect and share database data.
Software
DBMS: The software that controls the database, storing and managing data.
Operating System: Runs the computer and helps the DBMS work.
Applications: Programs that use the database for different tasks (e.g., business systems).
People
Database Administrator (DBA): Takes care of the database, making sure it runs well.
Users: People or programs that use the database to find or update information.
Developers: Create programs that work with the database.
Database Management System Functions
- Saves data and allows users to find it easily.
- Lets users design the database structure (e.g., tables and fields).
- Allows adding, deleting, and updating data.
- Manages multiple users using the database at the same time.
- Saves copies of data and restores them if needed.
- Ensures data is correct and follows rules.
Keys in Relational Databases
Keys help identify records and connect tables.
Types of Keys
- Primary Key: A unique column (or group of columns) that identifies each row.
- Foreign Key: A column that links one table to another table’s primary key.
- Candidate Key: A column that can be a primary key but is not chosen.
- Superkey: A group of columns that can uniquely identify rows, but may include extra columns.
- Composite Key: A primary key made up of two or more columns.
Characteristics of a Relational Table
- Made up of rows and columns.
- Each row represents a record.
- Each column holds a type of information.
- Each row is unique, usually enforced by a primary key.
Significance
Rows (Tuples): Represent real-world records, like a student’s details.
Columns (Attributes): Define what kind of data is stored, like names or ages.
Entity-Relationship Diagram (ERD)
An ERD is a visual diagram that shows how different parts of a database are connected. It helps in designing and understanding database structures.
Main Components of ERD
- Entities: Objects or things in the real world (e.g., Students, Courses).
- Attributes: Characteristics of an entity (e.g., Student ID, Course Name).
- Relationships: Connections between entities (e.g., A student enrolls in a course).
- Cardinality: Shows the number of relationships between entities (e.g., One-to-Many).
Cardinality
Cardinality defines how many instances of one entity can relate to instances of another entity in a database relationship.
Types of Cardinality
- One-to-One (1:1): One entity A is linked to only one entity B.
- One-to-Many (1:N): One entity A is linked to multiple entities B.
- Many-to-Many (M:N): Many instances of A relate to many instances of B.
Relationship Degree
The relationship degree is the number of entities involved in a relationship in an ERD.
Types of Relationship Degrees
- Unary Relationship: Involves a single entity.
- Binary Relationship: Involves two entities.
- Ternary Relationship: Involves three entities.