COSC 411 Summary-V2.0
COSC 411 Summary-V2.0
Entities: represent objects or things in the real world that have distinct existence. For
example, in a school database, entities might include Student, Teacher, Course, etc.
One-to-One (1:1): One entity in set A is related to at most one entity in set B, and
vice versa. Example: Each person has a unique passport number, and each
passport number is assigned to only one person.
One-to-Many (1:M): One entity in set A can be related to multiple entities in set
B, but an entity in set B is related to at most one entity in set A. Example: A
single department in a company can have many employees, but each employee
belongs to only one department.
Many-to-Many (M:M): An entity in set A can be related to multiple entities in set
B, and an entity in set B can be related to multiple entities in set A. Example:
Students and courses – a student can enroll in many courses, and a course can have
many students.
Many-to-One (M:1): In a many-to-one relationship, many instances of one entity
can be associated with a single instance of another entity. Example: Students and
University: Many students attend one university. Here, the relationship is many
students (set A) to one university (set B).
Cardinality refers to the number of instances of one entity that can or must be associated
with each instance of another entity. Cardinality specifies the minimum and maximum
number of relationships in which an entity can participate. It is expressed as a pair of
values: (minimum, maximum).
Minimum Cardinality: The least number of entity instances that must participate
in a relationship. Example: In a mandatory one-to-many relationship between
departments and employees, the minimum cardinality from department to
employees might be one, meaning each department must have at least one
employee.
Maximum Cardinality: The greatest number of entity instances that can
participate in a relationship. Example: In a one-to-many relationship between
departments and employees, the maximum cardinality from department to
employees might be many, meaning each department can have many employees.
KEY DIFFERENCES
Connectivity: Focuses on the type of relationship between entities (one-to-one, one-to-
many, many-to-many). While
Cardinality: Focuses on the number of entity instances that can participate in a
relationship (minimum and maximum).
In summary, connectivity tells you about the possible types of relationships between
entities, while cardinality provides detailed constraints on how many instances of each
entity can or must participate in these relationships.
DEGREES OF RELATIONSHIPS
o Entity: Employee
o Relationship: Supervises
o Description: An employee can supervise other employees, and each
employee can have a supervisor.
ISA RELATIONSHIP
also known as the "IS-A" relationship, is used to model inheritance in database design.
This relationship is particularly useful in object-oriented design where a subclass inherits
properties and behaviors from a superclass.
DISJOINT CONSTRAINT
The disjoint constraint ensures that an entity instance can belong to only one subclass in
the inheritance hierarchy. It specifies that an entity can be a member of at most one sub
class. And there can no be overlap between the subclass.
OVERLAP CONSTRAINT
The overlap constraint allows an entity instance to belong to multiple subclasses
simultaneously. It does not enforce exclusivity among subclasses.
Specialization: is the process of taking an entity and creating several specialized classes.
it is either disjoint or overlapping.
Generalization: is the process of taking several related entities and creating a general
class. It is total or partial.
COMPLETENESS CONSTRAINT
This can be total or partial. For total every entity in the superclass must belong to a
subclass while for partial, entities in the superclass do not need to be part of any subclass.
DATABASE
A database is an organized collection of structured information, or data, typically stored
electronically in a computer system. It allows for efficient retrieval, manipulation, and
management of data using database management systems (DBMS).
TYPES OF DATABASES
1. Relational Databases (RDBMS): Tables with rows and columns. Examples:
MySQL, PostgreSQL, Oracle, SQL Server
2. NoSQL Databases: Types: Document, Key-Value, Column-family, Graph.
Examples: MongoDB, Cassandra, Redis, CouchDB
3. Object-Oriented Databases: Structure: Data stored as objects. Examples:
db4o, ObjectDB
4. Hierarchical Databases: Structure: Tree-like structure with parent-child
relationships. Examples: IBM Information Management System (IMS)
5. Network Databases: Structure: Graph-like structure allowing multiple parent
records. Examples: Integrated Data Store (IDS), CA-IDMS
DATABASE SCHEMA
A database schema is the blueprint or logical structure of a database that defines how
data is organized and how relationships among the data are associated. It includes the
definitions of tables, columns, data types, indexes, and the relationships between tables
TYPES OF DB SCHEMA
1. Physical Schema: Defines the physical storage structure of the database.
2. Logical Schema: Describes the logical structure of the database.
3. External schema is an essential part of the database architecture that provides
customized, secure, and efficient views of the data for different users, enhancing both
usability and security.
ADVANTAGES OF DDBMS
1. Improved Performance: Distributes data across multiple locations, allowing
for parallel processing and faster query response times.
2. Enhanced Reliability and Availability: Provides fault tolerance and disaster
recovery by replicating data across different sites, ensuring continuous access even
if some sites fail.
3. Scalability: Easily scales to handle increased data and user load by adding more
nodes or sites to the system without significant reconfiguration.
4. Data Localization: Reduces data access latency by placing data closer to where
it is most frequently used, improving overall system efficiency.
5. Resource Sharing: Allows multiple locations to share data and computing
resources, leading to better resource utilization and cost efficiency.
DATA FRAGMENTATION
Data Fragmentation refers to the process of dividing a large database into smaller,
manageable pieces or fragments. This technique is used to improve the performance and
efficiency of database systems.
Types:
Horizontal Fragmentation: Divides data by tuples/rows. Each fragment contains
a subset of rows from the original table, based on some criteria (e.g., regional
data).
Vertical Fragmentation: Divides data by columns. Each fragment includes a
subset of columns, useful for different applications needing different data
attributes.
Hybrid Fragmentation: Combines both horizontal and vertical fragmentation to
further refine data distribution.
CORRECTNESS OF FRAGMENTATION
ensures that data is divided accurately and can be correctly reconstructed.
Completeness: All data from the original database must be present in the
fragments. No data is lost during the fragmentation process.
Reconstruction: The original database must be accurately rebuilt from its
fragments. You should be able to piece all the fragments back together to get the
complete, original database.
Disjointness: Each fragment should be unique and not overlap with others. No
data should be duplicated across fragments; each piece of data appears in only one
fragment.
Reconstruction for horizontal fragmentation is Union operation and join for vertical.
These rules ensure that the fragmented database works correctly and that all data can be
accurately and efficiently managed.
Derived horizontal fragmentation: It is the partitioning of a primary relation to other
secondary relations which are related with foreign keys.
FRAGMENTATION SCHEMA
refers to the plan for how a database is divided into fragments. It’s a structured outline of
how the database is split into different pieces (fragments). These pieces can be divided
horizontally (by rows) or vertically (by columns), or a combination of both.
ALLOCATION SCHEMA
refers to how the fragments of a database are distributed and stored across different
locations or nodes.
DATA REPLICATION
Data replication involves creating copies of the database and storing them at multiple
locations or sites.
Full Replication: The entire database is duplicated and stored at each site
Partial Replication: Only specific parts or subsets of the database are replicated
to selected sites.
CONCURRENCY CONTROL
Distributed Concurrency Control: Managing how multiple transactions access and
modify the same data without conflicting.
Primary Site Technique: Designate one site as the primary coordinator for managing
transactions. This site oversees the process and ensures consistency across the
distributed database.
TRANSACTION MANAGEMENT
Concurrency Control and Commit: One site (a central coordinator) manages how
transactions are handled to ensure that multiple transactions don't conflict with
each other.
Two-Phase Locking: This is a method to manage how transactions access data.