ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Database Systems
    COMP2114
    Progress0 / 34 topics
    Topics
    1. Basic Database Concepts2. Database Approach vs File Based System3. Database Architecture4. Three Level Schema Architecture5. Data Independence6. Relational Data Model7. Attributes8. Schemas9. Tuples10. Domains11. Relation Instances12. Keys of Relations13. Integrity Constraints14. Relational Algebra15. Selection in Relational Algebra16. Projection in Relational Algebra17. Cartesian Product in Relational Algebra18. Types of Joins19. Normalization20. Functional Dependencies21. Normal Forms22. Entity-Relationship Model23. Entity Sets24. Attributes in Entity-Relationship Model25. Relationship in Entity-Relationship Model26. Entity-Relationship Diagrams27. Structured Query Language (SQL)28. Joins in SQL29. Sub-Queries in SQL30. Grouping and Aggregation in SQL31. Concurrency Control32. Database Backup and Recovery33. Indexes34. NoSQL Systems
    COMP2114›Basic Database Concepts
    Database SystemsTopic 1 of 34

    Basic Database Concepts

    7 minread
    1,173words
    Intermediatelevel

    Basic Database Concepts

    Databases are an essential part of modern computing, used to store and manage data in a structured manner. The Basic Database Concepts lay the foundation for understanding how databases are designed, organized, and managed. Let's break down these concepts in detail:

    1. Database

    A database is an organized collection of data that is stored and managed in a structured format. The data in a database is typically stored in tables (which consist of rows and columns), and it can be easily accessed, modified, managed, and updated. A database can store various types of information, such as numbers, text, dates, and even images.

    Key Characteristics:

    • Persistent: Data is stored permanently.
    • Structured: Data is stored in a predefined format (tables, rows, columns).
    • Accessible: Can be queried and updated using a database management system (DBMS).

    2. Database Management System (DBMS)

    A Database Management System (DBMS) is a software system that allows users to create, manage, and interact with databases. It provides an interface for users to perform operations like inserting, updating, deleting, and retrieving data from a database.

    Key Functions of DBMS:

    • Data Storage: Manages how data is stored, retrieved, and updated in a database.
    • Data Security: Ensures that data is protected against unauthorized access.
    • Data Integrity: Ensures that the data remains accurate and consistent.
    • Concurrency Control: Manages simultaneous access to the database by multiple users.
    • Backup and Recovery: Ensures that data is recoverable in case of system failure.

    Examples of DBMS: MySQL, PostgreSQL, Oracle, Microsoft SQL Server, MongoDB.

    3. Data Model

    A data model defines how the data is structured and organized within a database. It dictates the relationships between different data entities and the rules for how data is stored.

    Common Data Models:

    • Relational Model: Data is stored in tables (relations), and each table consists of rows and columns. The relational model is used by most traditional DBMS (e.g., MySQL, PostgreSQL).
    • Hierarchical Model: Data is stored in a tree-like structure, with a parent-child relationship (e.g., XML databases).
    • Network Model: Data is organized using graph structures, where entities can have multiple relationships (e.g., IMS).
    • Object-Oriented Model: Data is stored as objects, which are instances of classes (similar to programming languages like Java or C++).

    4. Table (Relation)

    In the relational model, data is stored in tables (also called relations). A table is a collection of rows and columns:

    • Rows (also called records or tuples): Represent individual data entries in the table.
    • Columns (also called attributes or fields): Represent the properties or characteristics of the data.

    Example:

    EmployeeID Name Age Department
    101 John 30 HR
    102 Sarah 25 IT

    5. Primary Key

    A primary key is a column (or a combination of columns) in a table that uniquely identifies each row in the table. It ensures that no two rows have the same value in the primary key column(s), enforcing uniqueness and preventing duplication.

    Example: In the above table, EmployeeID could be the primary key, ensuring that each employee has a unique identifier.

    6. Foreign Key

    A foreign key is a column (or a set of columns) in one table that refers to the primary key in another table. It establishes a relationship between the two tables and ensures referential integrity, meaning the foreign key value must correspond to an existing primary key value.

    Example:

    • Table 1 (Employees) has a foreign key DepartmentID that refers to the DepartmentID primary key in the Departments table.
    • This ensures that each employee is assigned to a valid department.

    7. Schema

    A schema is a blueprint or structure that defines how the database is organized. It specifies the tables, the relationships between them, and the constraints (like primary and foreign keys). A schema can be seen as a description of the database's structure.

    Example: In the schema for an employee management system, it could define:

    • The Employee table with columns like EmployeeID, Name, and DepartmentID.
    • The Department table with columns like DepartmentID, DepartmentName.

    8. SQL (Structured Query Language)

    SQL is the language used to interact with relational databases. It is used to define, manipulate, and query data in the database. Key SQL operations include:

    • DDL (Data Definition Language): Defines the structure of the database, including commands like CREATE, ALTER, and DROP.
    • DML (Data Manipulation Language): Deals with data manipulation, including commands like SELECT, INSERT, UPDATE, and DELETE.
    • DCL (Data Control Language): Manages permissions and access control with commands like GRANT and REVOKE.
    • TCL (Transaction Control Language): Manages transactions in a database with commands like COMMIT and ROLLBACK.

    Example SQL query to retrieve employee information:

    SELECT * FROM Employees WHERE Department = 'IT';
    

    9. Normalization

    Normalization is the process of organizing data within a database to minimize redundancy and avoid undesirable characteristics like update anomalies. The goal of normalization is to split data into multiple related tables and ensure that data is stored efficiently and consistently.

    Common Normal Forms:

    • 1st Normal Form (1NF): Ensures that each column contains only atomic (indivisible) values and that each row is unique.
    • 2nd Normal Form (2NF): Ensures that data is free from partial dependency (no non-key attributes depend on part of a composite key).
    • 3rd Normal Form (3NF): Ensures that there are no transitive dependencies (non-key attributes must depend on the key).

    10. ACID Properties

    The ACID properties define the fundamental characteristics of a reliable database transaction:

    • Atomicity: A transaction is either fully completed or not at all; if any part fails, the entire transaction is rolled back.
    • Consistency: The database must remain in a consistent state before and after a transaction.
    • Isolation: Transactions are executed in isolation from one another to ensure that intermediate results are not visible to other transactions.
    • Durability: Once a transaction is committed, its changes are permanent, even in the event of a system crash.

    11. Index

    An index is a database object that improves the speed of data retrieval operations. It allows the database to quickly find rows based on the values in one or more columns, without having to scan the entire table.

    Example: If there is an index on the EmployeeID column, retrieving an employee's record by EmployeeID will be faster.

    12. Query Processing and Optimization

    Query processing refers to the steps involved in executing a query to retrieve data from a database. A query optimizer is responsible for determining the most efficient way to execute a query, considering factors like the use of indexes, join methods, and the cost of various operations.

    Summary

    To summarize, basic database concepts include understanding the structure of databases (tables, rows, columns), how data is organized and managed (schemas, data models), and how it is queried and manipulated using SQL. Key topics include primary and foreign keys, normalization, and the properties of reliable database transactions (ACID).

    These concepts are fundamental to designing and managing databases effectively and are essential for understanding how to work with databases in real-world scenarios.

    Next topic 2
    Database Approach vs File Based System

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time7 min
      Word count1,173
      Code examples0
      DifficultyIntermediate