Database Design
An Introduction to Database
Concepts and Design
Introduction to Databases
• - A database is an organized collection of
structured information.
• - It allows efficient data retrieval,
management, and storage.
• - Examples: banking systems, e-commerce
platforms, hospital records.
Comparison to File Systems
• - File systems store data in separate files
without connections.
• - Difficult to handle large data volumes,
redundancy, and consistency.
• - Databases solve these problems with central
management and structured access.
Problems with File Systems
• - Redundancy and inconsistency.
• - Difficulty in accessing and managing data.
• - Poor security and lack of concurrency
control.
Advantages of Databases
• - Data consistency and integrity.
• - Reduced redundancy.
• - Secure, concurrent, and efficient access.
File System vs Database
Using Conceptual Data Models
• - High-level models describe database
structure without technical details.
• - Entity-Relationship (ER) models focus on
entities, attributes, and relationships.
Entity Types
• - An entity type represents a class of objects.
• - Example: Employee, Department, Student.
Entity Sets
• - A collection of entities of the same type.
• - Example: All employees in a company form
the "Employee" entity set.
Attributes and Keys
• - Attributes define properties of entities (e.g.,
Name, Age).
• - Keys uniquely identify each entity (e.g.,
StudentID).
Relationship Types
• - Define how entities are associated.
• - Example: Employee "works for" Department.
Relationship Sets
• - A collection of similar relationships.
• - Example: All instances of "works for"
relationships.
Roles in Relationships
• - Roles clarify entity participation.
• - Example: Supervisor and Subordinate in
"Supervises" relationship.
Entities, Attributes, Relationships
This Photo by Unknown Author is licensed under CC BY-SA
Structural Constraints
• - Rules governing relationships (Cardinality:
1:1, 1:N, N:M).
• - Participation constraints (total or partial).
Weak Entity Types
• - Entities that depend on others for
identification.
• - Example: "Dependent" entity depends on
"Employee" entity.
ER Diagrams
• - Visual representation of entities, attributes,
and relationships.
• - Symbols: Rectangles (entities), Diamonds
(relationships), Ovals (attributes).
Naming Conventions
• - Use meaningful, consistent names.
• - Entities: singular nouns; Relationships: verbs.
Introduction to Keys
• - Unique attribute combinations identify entity
instances.
• - Support data integrity and retrieval.
ER Diagram with Weak Entity
This Photo by Unknown Author is licensed under CC BY-SA
Total vs Partial Participation
• Total Participation: Every entity instance must
participate (double line).
• Partial Participation: Some instances may not
participate (single line).
• Example: Every employee must work in a
department (total participation).
Cardinality Ratios Explained
• One-to-One (1:1): Each entity in A is related to
at most one entity in B.
• One-to-Many (1:N): One entity in A is related
to many entities in B.
• Many-to-Many (M:N): Many entities in A
relate to many in B.
Composite Attributes
• Composite attributes can be divided into
smaller sub-parts.
• Example: Address → Street, City, Zip Code.
• Useful for detailed information modeling.
Multivalued Attributes
• Multivalued attributes can have multiple
values for a single entity.
• Example: An employee with multiple phone
numbers.
• Represented with double ovals in ER diagrams.
Derived Attributes
• Derived attributes are calculated from other
attributes.
• Example: Age derived from Birthdate.
• Shown with dashed ovals in ER diagrams.
Identifying Relationships
• An identifying relationship links a weak entity
to its strong entity.
• The weak entity's table includes a foreign key
from the strong entity.
• Ensures data consistency and dependency.
Generalization vs Specialization
• Generalization: Bottom-up approach (combine
entities).
• Specialization: Top-down approach (divide into
sub-entities).
• Helps in managing inheritance among entities.
ER-to-Relational Mapping: 1:1
• For 1:1 relationships, the primary key of one
relation becomes the foreign key in another.
• Optionally merge both relations if
participation is total on both sides.
ER-to-Relational Mapping: 1:N
• For 1:N relationships, place the foreign key in
the relation on the 'N' side (many side).
• Example: Many employees belong to one
department.
ER-to-Relational Mapping: M:N
• For M:N relationships, create a new table.
• This table holds foreign keys referencing the
primary keys of the two related entities.
• Example: Students enrolled in Courses.

database_design_presentation, data base design presenttion

  • 1.
    Database Design An Introductionto Database Concepts and Design
  • 2.
    Introduction to Databases •- A database is an organized collection of structured information. • - It allows efficient data retrieval, management, and storage. • - Examples: banking systems, e-commerce platforms, hospital records.
  • 3.
    Comparison to FileSystems • - File systems store data in separate files without connections. • - Difficult to handle large data volumes, redundancy, and consistency. • - Databases solve these problems with central management and structured access.
  • 4.
    Problems with FileSystems • - Redundancy and inconsistency. • - Difficulty in accessing and managing data. • - Poor security and lack of concurrency control.
  • 5.
    Advantages of Databases •- Data consistency and integrity. • - Reduced redundancy. • - Secure, concurrent, and efficient access.
  • 6.
  • 7.
    Using Conceptual DataModels • - High-level models describe database structure without technical details. • - Entity-Relationship (ER) models focus on entities, attributes, and relationships.
  • 8.
    Entity Types • -An entity type represents a class of objects. • - Example: Employee, Department, Student.
  • 9.
    Entity Sets • -A collection of entities of the same type. • - Example: All employees in a company form the "Employee" entity set.
  • 10.
    Attributes and Keys •- Attributes define properties of entities (e.g., Name, Age). • - Keys uniquely identify each entity (e.g., StudentID).
  • 11.
    Relationship Types • -Define how entities are associated. • - Example: Employee "works for" Department.
  • 12.
    Relationship Sets • -A collection of similar relationships. • - Example: All instances of "works for" relationships.
  • 13.
    Roles in Relationships •- Roles clarify entity participation. • - Example: Supervisor and Subordinate in "Supervises" relationship.
  • 14.
    Entities, Attributes, Relationships ThisPhoto by Unknown Author is licensed under CC BY-SA
  • 15.
    Structural Constraints • -Rules governing relationships (Cardinality: 1:1, 1:N, N:M). • - Participation constraints (total or partial).
  • 16.
    Weak Entity Types •- Entities that depend on others for identification. • - Example: "Dependent" entity depends on "Employee" entity.
  • 17.
    ER Diagrams • -Visual representation of entities, attributes, and relationships. • - Symbols: Rectangles (entities), Diamonds (relationships), Ovals (attributes).
  • 18.
    Naming Conventions • -Use meaningful, consistent names. • - Entities: singular nouns; Relationships: verbs.
  • 19.
    Introduction to Keys •- Unique attribute combinations identify entity instances. • - Support data integrity and retrieval.
  • 20.
    ER Diagram withWeak Entity This Photo by Unknown Author is licensed under CC BY-SA
  • 21.
    Total vs PartialParticipation • Total Participation: Every entity instance must participate (double line). • Partial Participation: Some instances may not participate (single line). • Example: Every employee must work in a department (total participation).
  • 22.
    Cardinality Ratios Explained •One-to-One (1:1): Each entity in A is related to at most one entity in B. • One-to-Many (1:N): One entity in A is related to many entities in B. • Many-to-Many (M:N): Many entities in A relate to many in B.
  • 23.
    Composite Attributes • Compositeattributes can be divided into smaller sub-parts. • Example: Address → Street, City, Zip Code. • Useful for detailed information modeling.
  • 24.
    Multivalued Attributes • Multivaluedattributes can have multiple values for a single entity. • Example: An employee with multiple phone numbers. • Represented with double ovals in ER diagrams.
  • 25.
    Derived Attributes • Derivedattributes are calculated from other attributes. • Example: Age derived from Birthdate. • Shown with dashed ovals in ER diagrams.
  • 26.
    Identifying Relationships • Anidentifying relationship links a weak entity to its strong entity. • The weak entity's table includes a foreign key from the strong entity. • Ensures data consistency and dependency.
  • 27.
    Generalization vs Specialization •Generalization: Bottom-up approach (combine entities). • Specialization: Top-down approach (divide into sub-entities). • Helps in managing inheritance among entities.
  • 28.
    ER-to-Relational Mapping: 1:1 •For 1:1 relationships, the primary key of one relation becomes the foreign key in another. • Optionally merge both relations if participation is total on both sides.
  • 29.
    ER-to-Relational Mapping: 1:N •For 1:N relationships, place the foreign key in the relation on the 'N' side (many side). • Example: Many employees belong to one department.
  • 30.
    ER-to-Relational Mapping: M:N •For M:N relationships, create a new table. • This table holds foreign keys referencing the primary keys of the two related entities. • Example: Students enrolled in Courses.