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.
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.