SlideShare a Scribd company logo
Building a Multitable
Relational Database
Ovezov Atanazar
What is a Relational Database?
β€’ A relational database is a type of database that
stores data in tables, where each table
represents a specific entity. The rows in these
tables contain individual records, and the
columns define the attributes of those records.
Relational databases are based on mathematical
principles and use Structured Query Language
(SQL) to manage and query data.
Why Multitable Design?
β€’ Multitable database design is essential
for maintaining data integrity and
avoiding redundancy. For instance,
instead of storing a student's personal
information multiple times across
different tables, a multitable approach
links student records to other data using
unique identifiers. This approach makes
the database more organized, easier to
maintain, and more efficient to query.
Key Components of a Relational Database
Relational databases consist of several critical
components:
β€’Tables: These are the primary structures where data is
stored.
β€’Primary Keys: Unique identifiers for each row in a table.
β€’Foreign Keys: Attributes that establish a relationship
between tables, ensuring data consistency and
integrity.
Relational Algebra
β€’ Relational algebra provides the
theoretical foundation for operations in a
relational database. It defines a set of
operations like selection, projection, and
joining that allow us to manipulate and
retrieve data efficiently. For example, the
JOIN operation combines data from two
or more tables based on related
columns, enabling complex queries
across multiple tables.
Data Normalization
Normalization is a process that organizes data to reduce
redundancy and improve efficiency. It involves dividing a
database into smaller tables and defining relationships between
them. The three main normal forms include:
β€’First Normal Form (1NF): Ensures that each column contains
atomic values.
β€’Second Normal Form (2NF): Eliminates partial dependencies on
the primary key.
β€’Third Normal Form (3NF): Removes transitive dependencies.
Example of Normalization
Imagine a table where student data, course names, and
instructors are stored together. This structure may lead
to repeated information, such as the same course name
being listed for multiple students. By normalizing the
data:
β€’ 1. The Student Table contains only student-specific
information.
β€’ 2. The Course Table holds course-specific details.
β€’ 3. A linking Enrollment Table connects students to
courses, reducing redundancy.
Requirements Analysis
The first step in designing a multitable relational
database is understanding the requirements of
the system. This involves identifying the type of
data to be stored, the relationships between
different types of data, and the types of queries
users will perform. For example, a library system
must track books, members, and loans while
enabling users to search for available books.
Conceptual Design
β€’ The conceptual design phase uses tools
like Entity-Relationship (ER) diagrams to
visualize the data model. Entities represent
real-world objects, such as students or
books, and relationships define how these
entities interact. For example, an ER
diagram for a university database would
show entities like Students, Courses, and
Enrollments, with lines connecting them to
illustrate relationships.
Sample ER Diagram
A sample ER diagram for a university database
includes:
β€’Entities: Students, Courses, Instructors.
β€’Attributes: Each entity's unique details, such as
StudentID or CourseName.
β€’Relationships: How entities are connected,
such as "Students enroll in Courses."
Logical Design
β€’ After creating the conceptual model, the
next step is to translate it into a
relational schema. Each entity becomes
a table, with attributes as columns.
Relationships are implemented using
foreign keys. For example, the Students
table might have columns for StudentID,
Name, and Major, while the Enrollments
table links students to courses using
StudentID and CourseID.
Schema Design Example
In a library system:
β€’Books Table: Stores information like BookID, Title,
and Author.
β€’Members Table: Contains MemberID, Name, and
Address.
β€’Loans Table: Links Members to Books using
MemberID and BookID, with additional details like
LoanDate and ReturnDate.
Importance of Primary and Foreign Keys
β€’ Primary keys ensure that every
record in a table is unique,
preventing duplicate entries. Foreign
keys enforce relationships between
tables, ensuring that related data
remains consistent. For example, if a
student record is deleted, foreign key
constraints can prevent the removal
of associated enrollment records.
Creating Tables
SQL commands are used to create tables in a
database. For example:
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
Name VARCHAR(100),
Major VARCHAR(50)
);
This command creates a Students table with columns
for student information.
Populating Tables
Once tables are created, they can be
populated with data using INSERT
INTO statements.
INSERT INTO Students (StudentID,
Name, Major)
VALUES (1, 'Alice', 'Computer
Science');
Querying Multitable Databases
To retrieve data from multiple tables, JOIN operations
are used.
SELECT Students.Name, Courses.Title
FROM Students
JOIN Enrollment ON Students.StudentID =
Enrollment.StudentID
JOIN Courses ON Enrollment.CourseID =
Courses.CourseID;
This query lists students along with the courses they are
enrolled in.
Data Integrity and Constraints
β€’ Maintaining data integrity is
crucial in database design.
Constraints like NOT NULL,
UNIQUE, and FOREIGN KEY ensure
that data remains valid. For
example, a NOT NULL constraint
on the Name column prevents
adding a student without a name.
Performance Optimization
Indexing is a technique used to speed up data
retrieval. For example, creating an index on
the StudentID column allows faster searches
in the Students table. Additionally, query
optimization ensures that SQL statements are
written efficiently.
Practical Example - Library Management
System
A library database consists of:
β€’ Books Table for storing book
information.
β€’ Members Table for member details.
β€’ Loans Table for tracking which books are
borrowed by which members.
Global Applications of Relational Databases
Relational databases are used worldwide
in industries like e-commerce, banking,
healthcare, and education. They enable
businesses to store and analyze data
efficiently, supporting operations like
customer management, order
processing, and financial tracking.
Challenges in Multitable Design
β€’ Designing multitable databases can
be challenging. Issues include
ensuring data consistency,
managing complex relationships,
and optimizing query performance.
Addressing these challenges
requires a thorough understanding
of database principles and careful
planning.
Case Study
A university database is designed to
manage students, courses, and
instructors. Tables like Students,
Courses, and Enrollments are linked to
enable functionalities like listing
students in a course or finding courses
taught by an instructor.
Summary
β€’ Multitable relational databases
provide a robust framework for
organizing and managing data.
By normalizing data, defining
relationships, and ensuring data
integrity, these databases
support efficient and scalable
applications.
Conclusion
Building a multitable relational database
is a systematic process involving design,
implementation, and optimization. When
done correctly, it creates a reliable and
efficient system for managing complex
data relationships.
THANK YOU!

More Related Content

PPTX
Relational Database Design
PPT
DB Design.ppt
PPT
week3.ppt
PPTX
Database design process
PPTX
Accounting Information System Related Data.pptx
PDF
Access 05
PPT
Database intro
PPT
demo2.ppt
Relational Database Design
DB Design.ppt
week3.ppt
Database design process
Accounting Information System Related Data.pptx
Access 05
Database intro
demo2.ppt

Similar to Database about data and programming lofe.pptx (20)

PPTX
Data Types and Physical Data Models MS Access
PPTX
Data Types and Physical Data Models v 123
PPT
603s129
PDF
RELATIONAL DBMS, what is a man that goes around me that you NOTE.pdf
PDF
Lecture 02 ❘ Relational Data Model in Data Science.pdf
PPTX
DBMS: Week 04 - Relational Model in a Database
PPT
2 Relational Database Concepts.ppt
PPT
Database
PPT
Nunes database
PPT
Database Design Process
PPTX
Distributed database
PDF
Basics of Database Design
PPTX
2 The Relational Database Model_ chapter 2.pptx
PPTX
Data resource management
PPTX
Relational model
PPT
Dbms Lec Uog 02
PPTX
The relational database model chapter 2
PDF
Relational databases.pdf
PDF
Relational database (Unit 2)
Data Types and Physical Data Models MS Access
Data Types and Physical Data Models v 123
603s129
RELATIONAL DBMS, what is a man that goes around me that you NOTE.pdf
Lecture 02 ❘ Relational Data Model in Data Science.pdf
DBMS: Week 04 - Relational Model in a Database
2 Relational Database Concepts.ppt
Database
Nunes database
Database Design Process
Distributed database
Basics of Database Design
2 The Relational Database Model_ chapter 2.pptx
Data resource management
Relational model
Dbms Lec Uog 02
The relational database model chapter 2
Relational databases.pdf
Relational database (Unit 2)
Ad

Recently uploaded (20)

PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
Internet___Basics___Styled_ presentation
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
Β 
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
SAP Ariba Sourcing PPT for learning material
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PPTX
artificial intelligence overview of it and more
PDF
The Internet -By the Numbers, Sri Lanka Edition
Β 
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPT
tcp ip networks nd ip layering assotred slides
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
WebRTC in SignalWire - troubleshooting media negotiation
Internet___Basics___Styled_ presentation
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
SASE Traffic Flow - ZTNA Connector-1.pdf
Slides PDF The World Game (s) Eco Economic Epochs.pdf
RPKI Status Update, presented by Makito Lay at IDNOG 10
Β 
QR Codes Qr codecodecodecodecocodedecodecode
Design_with_Watersergyerge45hrbgre4top (1).ppt
SAP Ariba Sourcing PPT for learning material
PptxGenJS_Demo_Chart_20250317130215833.pptx
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
artificial intelligence overview of it and more
The Internet -By the Numbers, Sri Lanka Edition
Β 
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Sims 4 Historia para lo sims 4 para jugar
Module 1 - Cyber Law and Ethics 101.pptx
Cloud-Scale Log Monitoring _ Datadog.pdf
presentation_pfe-universite-molay-seltan.pptx
tcp ip networks nd ip layering assotred slides
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Ad

Database about data and programming lofe.pptx

  • 1. Building a Multitable Relational Database Ovezov Atanazar
  • 2. What is a Relational Database? β€’ A relational database is a type of database that stores data in tables, where each table represents a specific entity. The rows in these tables contain individual records, and the columns define the attributes of those records. Relational databases are based on mathematical principles and use Structured Query Language (SQL) to manage and query data.
  • 3. Why Multitable Design? β€’ Multitable database design is essential for maintaining data integrity and avoiding redundancy. For instance, instead of storing a student's personal information multiple times across different tables, a multitable approach links student records to other data using unique identifiers. This approach makes the database more organized, easier to maintain, and more efficient to query.
  • 4. Key Components of a Relational Database Relational databases consist of several critical components: β€’Tables: These are the primary structures where data is stored. β€’Primary Keys: Unique identifiers for each row in a table. β€’Foreign Keys: Attributes that establish a relationship between tables, ensuring data consistency and integrity.
  • 5. Relational Algebra β€’ Relational algebra provides the theoretical foundation for operations in a relational database. It defines a set of operations like selection, projection, and joining that allow us to manipulate and retrieve data efficiently. For example, the JOIN operation combines data from two or more tables based on related columns, enabling complex queries across multiple tables.
  • 6. Data Normalization Normalization is a process that organizes data to reduce redundancy and improve efficiency. It involves dividing a database into smaller tables and defining relationships between them. The three main normal forms include: β€’First Normal Form (1NF): Ensures that each column contains atomic values. β€’Second Normal Form (2NF): Eliminates partial dependencies on the primary key. β€’Third Normal Form (3NF): Removes transitive dependencies.
  • 7. Example of Normalization Imagine a table where student data, course names, and instructors are stored together. This structure may lead to repeated information, such as the same course name being listed for multiple students. By normalizing the data: β€’ 1. The Student Table contains only student-specific information. β€’ 2. The Course Table holds course-specific details. β€’ 3. A linking Enrollment Table connects students to courses, reducing redundancy.
  • 8. Requirements Analysis The first step in designing a multitable relational database is understanding the requirements of the system. This involves identifying the type of data to be stored, the relationships between different types of data, and the types of queries users will perform. For example, a library system must track books, members, and loans while enabling users to search for available books.
  • 9. Conceptual Design β€’ The conceptual design phase uses tools like Entity-Relationship (ER) diagrams to visualize the data model. Entities represent real-world objects, such as students or books, and relationships define how these entities interact. For example, an ER diagram for a university database would show entities like Students, Courses, and Enrollments, with lines connecting them to illustrate relationships.
  • 10. Sample ER Diagram A sample ER diagram for a university database includes: β€’Entities: Students, Courses, Instructors. β€’Attributes: Each entity's unique details, such as StudentID or CourseName. β€’Relationships: How entities are connected, such as "Students enroll in Courses."
  • 11. Logical Design β€’ After creating the conceptual model, the next step is to translate it into a relational schema. Each entity becomes a table, with attributes as columns. Relationships are implemented using foreign keys. For example, the Students table might have columns for StudentID, Name, and Major, while the Enrollments table links students to courses using StudentID and CourseID.
  • 12. Schema Design Example In a library system: β€’Books Table: Stores information like BookID, Title, and Author. β€’Members Table: Contains MemberID, Name, and Address. β€’Loans Table: Links Members to Books using MemberID and BookID, with additional details like LoanDate and ReturnDate.
  • 13. Importance of Primary and Foreign Keys β€’ Primary keys ensure that every record in a table is unique, preventing duplicate entries. Foreign keys enforce relationships between tables, ensuring that related data remains consistent. For example, if a student record is deleted, foreign key constraints can prevent the removal of associated enrollment records.
  • 14. Creating Tables SQL commands are used to create tables in a database. For example: CREATE TABLE Students ( StudentID INT PRIMARY KEY, Name VARCHAR(100), Major VARCHAR(50) ); This command creates a Students table with columns for student information.
  • 15. Populating Tables Once tables are created, they can be populated with data using INSERT INTO statements. INSERT INTO Students (StudentID, Name, Major) VALUES (1, 'Alice', 'Computer Science');
  • 16. Querying Multitable Databases To retrieve data from multiple tables, JOIN operations are used. SELECT Students.Name, Courses.Title FROM Students JOIN Enrollment ON Students.StudentID = Enrollment.StudentID JOIN Courses ON Enrollment.CourseID = Courses.CourseID; This query lists students along with the courses they are enrolled in.
  • 17. Data Integrity and Constraints β€’ Maintaining data integrity is crucial in database design. Constraints like NOT NULL, UNIQUE, and FOREIGN KEY ensure that data remains valid. For example, a NOT NULL constraint on the Name column prevents adding a student without a name.
  • 18. Performance Optimization Indexing is a technique used to speed up data retrieval. For example, creating an index on the StudentID column allows faster searches in the Students table. Additionally, query optimization ensures that SQL statements are written efficiently.
  • 19. Practical Example - Library Management System A library database consists of: β€’ Books Table for storing book information. β€’ Members Table for member details. β€’ Loans Table for tracking which books are borrowed by which members.
  • 20. Global Applications of Relational Databases Relational databases are used worldwide in industries like e-commerce, banking, healthcare, and education. They enable businesses to store and analyze data efficiently, supporting operations like customer management, order processing, and financial tracking.
  • 21. Challenges in Multitable Design β€’ Designing multitable databases can be challenging. Issues include ensuring data consistency, managing complex relationships, and optimizing query performance. Addressing these challenges requires a thorough understanding of database principles and careful planning.
  • 22. Case Study A university database is designed to manage students, courses, and instructors. Tables like Students, Courses, and Enrollments are linked to enable functionalities like listing students in a course or finding courses taught by an instructor.
  • 23. Summary β€’ Multitable relational databases provide a robust framework for organizing and managing data. By normalizing data, defining relationships, and ensuring data integrity, these databases support efficient and scalable applications.
  • 24. Conclusion Building a multitable relational database is a systematic process involving design, implementation, and optimization. When done correctly, it creates a reliable and efficient system for managing complex data relationships.