What is a Database?

A database is any organized collection of data. While a spreadsheet or document can store data, it is not ideal for large-scale or structured access.

For example:

  • Easy: Storing a small list of books in Excel.

  • Difficult: Managing 100,000 books with authors, publishers, and multiple copies using Excel.

What is a Relational Database?

A Relational Database Management System (RDBMS) organizes data into tables that are connected through relationships. Oracle is one of the most powerful RDBMS platforms.

Table Structure

Table ComponentDescription
TableA collection of related data rows
RowA single record
ColumnA field that defines data type and label
SchemaA collection of tables and objects owned by a user

In Oracle:

  • A user owns a schema.

  • Two users can have tables with the same name because ownership is separate.

Why Use Relational Design?

Consider storing data about books and authors in one table. This causes data repetition if an author wrote multiple books.

Instead, normalize the data:

  • Create a separate AUTHORS table.

  • Link it to the BOOKS table using a foreign key.

ERD (Entity Relationship Diagram)

To understand how relational databases work, let’s look at a simple example with two tables: AUTHORS and BOOKS.

SQL Syntax to Create Tables:

CREATE TABLE authors (
  id         NUMBER PRIMARY KEY,
  first_name VARCHAR2(50),
  last_name  VARCHAR2(50)
);

CREATE TABLE books (
  isbn      CHAR(10) PRIMARY KEY,
  category  VARCHAR2(20),
  title     VARCHAR2(100),
  num_pages NUMBER,
  price     NUMBER,
  copyright NUMBER(4),
  author1   NUMBER CONSTRAINT books_author1
            REFERENCES authors(id)
);

AUTHORS Table

IDFirst NameLast Name
1JohnSmith
2AliceBrown

BOOKS Table

ISBNCategoryTitleNum PagesPriceCopyrightAuthor ID
1001TechMastering PL/SQL35039920231
1002FictionThe Silent Writer28029920222

Example Query: JOIN Authors and Books:

SELECT b.title, a.first_name, a.last_name
FROM authors a, books b
WHERE b.author1 = a.id;

This joins the tables on the author1 foreign key, producing output like:

TitleFirst NameLast Name
Mastering PL/SQLJohnSmith
The Silent WriterAliceBrown

Benefits of Relational Databases

FeatureAdvantage
Redundancy ReductionNo repeated author info for each book
Data IntegrityUses primary and foreign keys
ScalabilityEasy to expand with more entities (e.g., Publisher)
ModularitySeparate logic for each entity (Authors, Books, etc.)
Scroll to Top