1. Home
  2. Explore
  3. Computer Science
  4. Database Concepts Introduction

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Database Concepts Introduction

Database Fundamentals - Comprehensive Study Notes

Why Storing Data in a List Is Problematic

Redundancy and Inefficiency

  • A simple two-dimensional list (table) can cause data redundancy when the same information appears multiple times (e.g., a project manager managing multiple projects stores their name, ID, and extension repeatedly).

  • Redundancy wastes storage space and introduces inconsistency risks.

Multiple Business Themes in One List

  • A business concept (or business theme) is a set of attributes naturally related to one type of entity (e.g., Employee, Department, Product, Customer, Order).

  • Storing data about multiple themes in the same list mixes unrelated information (e.g., mixing project manager details with project details).

  • This creates data anomalies—problems that occur when modifying the data.

Three Types of Data Anomalies

  • Update Anomaly: Changing a single fact (e.g., a student’s advisor) may require updating multiple rows, risking inconsistency.

  • Deletion Anomaly: Deleting a row (e.g., a student who drops out) can unintentionally remove valuable information about another entity (e.g., an advisor with no other advisees).

  • Insertion Anomaly: Adding a new entity (e.g., a department) requires inserting rows with many empty fields because other attributes (student, advisor) are missing.

Key Takeaway: Lists make it difficult to maintain data integrity—the accuracy and consistency of stored data.


Purpose and Advantages of Databases

Three Core Purposes

  1. Repository for storing data – where data is kept.

  2. Organizational structure for data – data is arranged logically.

  3. Mechanism for interacting with data – supports the four basic operations.

The Four Basic Operations (CRUD)

  • Create – add new data.

  • Read – query or retrieve data.

  • Update – modify existing data.

  • Delete – remove data.

CRUD (Create, Read, Update, Delete) is the acronym that captures these fundamental data interactions.

Modeling Natural Business Relationships

  • In business, data have hierarchical relationships (e.g., one customer places many orders; one department has many employees).

  • A relational database allows these relationships to be modeled and represented explicitly.


The Relational Database Model

Tables, Rows, and Columns

  • Data are stored in tables (two-dimensional grids).

  • Columns represent attributes of an entity (e.g., Employee ID, Name, Phone).

  • Rows represent instances of that entity (e.g., a specific employee).

Separating Data by Business Theme

  • Instead of one big list, data for each business concept is placed in its own table (e.g., an Employee table, a Department table).

  • This eliminates redundancy and anomalies.

Linking Tables with Matched Values

  • Related tables are connected using matched pairs of values.

  • Example: A Customer ID in the Customer table is stored in the Project table to link each project to its customer.

  • This linking enables joins—operations that reassemble the data into a list when needed (e.g., for reports).

Key Concept: Relational databases use relationships between tables to represent real-world connections without duplicating data.


Structured Query Language (SQL)

What Is SQL?

  • Structured Query Language (SQL) is the primary tool for performing CRUD operations on relational databases.

  • It is designed to be simple to use and understand—not a full programming language.

  • Learning SQL allows you to work with virtually any modern database (SQL Server, Oracle, MySQL, DB2, Access, etc.).

Example: SELECT Statement

SELECT Customer.LastName, Customer.FirstName, Customer.Phone,
       Enrollment.Date, Enrollment.AmountPaid,
       Course.CourseName, Course.TotalFee
FROM Customer
JOIN Enrollment ON Customer.CustomerNumber = Enrollment.CustomerNumber
JOIN Course ON Enrollment.CourseNumber = Course.CourseNumber;
  • This SELECT statement retrieves data from three tables (Customer, Enrollment, Course) and joins them using matching values (customer numbers, course numbers).

  • The result restores a list view containing customer details, course dates, payments, and fees.

SQL also supports INSERT, UPDATE, and DELETE operations to modify data directly.


Database System Components

A complete database system consists of four interacting components:

1. Users

  • Human beings or other software programs that need data.

  • Examples: checking bank balances online, producing reports, searching Wikipedia.

2. Database Applications

  • Software programs that rely on the database (e.g., websites, mobile apps, desktop applications).

  • Applications do not access the database directly; they communicate through the DBMS.

3. Database Management System (DBMS)

  • A special gatekeeper program that controls all access to the database.

  • Key functions:

    • Create databases and tables

    • Establish relationships between tables

    • Read, write, edit, delete data

    • Enforce rules and constraints

    • Provide security, backup, and recovery

  • The DBMS is not the database itself—it manages the database.

4. Database

  • The actual self-describing collection of related records.

  • Contains not only raw data but also:

    • Metadata – data that describe the structure of the data (e.g., "Employee ID is an integer").

    • Overhead data – indexes that improve performance, logs, etc.

    • Application metadata – user preferences, configurations.

Key Idea: All data flow must pass through the DBMS, ensuring data integrity and security.


Metadata and Constraints

Metadata

  • Metadata are data about data. In a database, metadata describe the structure of the stored data: table names, column names, data types, relationships.

  • The database is self-describing because it includes its own definition.

Referential Integrity Constraints

  • A critical rule enforced by the DBMS to ensure data quality.

  • Referential integrity guarantees that a value in one table (e.g., a foreign key) has a matching value in another table.

  • Example: If you try to add a project with CustomerID = 5, the DBMS checks that customer 5 actually exists in the Customer table. If not, the insertion is rejected.

  • This prevents "orphan" records and maintains consistency.

Referential Integrity is one of the most important constraints for preserving data integrity across related tables.


Types of Database Systems

Personal Database Systems

  • Designed for single-user or very small-scale use.

  • Simple, not suitable for medium/large businesses.

  • Often combine the DBMS and database application tools (e.g., forms, reports).

  • Example: Microsoft Access.

Enterprise-Level Database Systems

  • Designed for multiple simultaneous users (thousands or tens of thousands).

  • Serve data to more than one application (e.g., website + internal dashboards).

  • Can be distributed across multiple physical computers and geographically dispersed (e.g., data centers in different cities).

  • Support multiple databases within one DBMS (e.g., an operational database + a data warehouse).

  • Handle complex, large-scale implementations (e.g., ERP systems like SAP with thousands of tables).

  • Examples:

    • SQL Server (used in this course)

    • Oracle

    • MySQL (free and open-source)

    • DB2

Visualizing an Enterprise-Level System

Users → Applications (Web, Mobile, Desktop) → DBMS → Database(s)

The DBMS remains the central intermediary, ensuring all applications access data through a controlled layer.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent