Docsity

relatyional database models, Summaries of Visual Arts

Toggle sidebar
bg1
Basic Concepts of Relational Model
Entity
In a relational model, an entityrepresents a real-world object or concept that can be
uniquely identified and has independent existence, such as a person, a product, or a
course.In anEntity-RelationshipDiagram(ERD), an entity is depicted as a rectangle
containing its name and listing itsattributes.In a relational database, each entity in the
ER model typically corresponds to a table, with its attributes becoming the columns of
that table, and individual instances of the entity (e.g., a specific student) existing as rows
within that table.
Characteristics of an Entity
i. Independent Existence:Entities have a real-world presence and can be tracked in a
database.
ii. Identifiable:Each entity can be distinguished from others, often through a unique
identifier called aprimary key.
iii. Described by Attributes:Entities are characterized by properties known as attributes
(e.g., a "Customer" entity might have attributes like "Customer ID," "Name," and
"Address").
iv. Represented in ERDs:They are graphically shown as rectangles in ER diagrams.
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download relatyional database models and more Summaries Visual Arts in PDF only on Docsity!

Basic Concepts of Relational Model Entity In a relational model, an entity represents a real-world object or concept that can be uniquely identified and has independent existence, such as a person, a product, or a course. In an Entity-Relationship Diagram (ERD), an entity is depicted as a rectangle containing its name and listing its attributes. In a relational database, each entity in the ER model typically corresponds to a table, with its attributes becoming the columns of that table, and individual instances of the entity (e.g., a specific student) existing as rows within that table. Characteristics of an Entity i. Independent Existence: Entities have a real-world presence and can be tracked in a database. ii. Identifiable: Each entity can be distinguished from others, often through a unique identifier called a primary key. iii. Described by Attributes: Entities are characterized by properties known as attributes (e.g., a "Customer" entity might have attributes like "Customer ID," "Name," and "Address"). iv. Represented in ERDs: They are graphically shown as rectangles in ER diagrams.

Examples of Entities i. People: Student, Employee, Customer ii. Objects: Book, Car, Invoice iii. Concepts: Profile, Department iv. Events: Transaction, Order Relationship In a relational model, a relationship is a logical connection between tables (relations) based on shared data, often established using foreign keys that link rows in one table to rows in another. These relationships represent real-world associations and dependencies between entities, allowing for efficient data structuring, data integrity, and reduction of redundancy. The most common relationship types are one-to-one, one-to-many, and many-to-many, each defined by the number of entities in one table that can be associated with entities in another. How Relationships Work a) Foreign Keys: Relationships are created by placing a column in one table that matches the primary key of another table. This "foreign key" acts as a pointer, creating the link between the two tables. b) Data Integrity: Relationships enforce referential integrity, ensuring that the data in the related tables remains consistent. c) Reduced Redundancy: By linking related data rather than duplicating it, relationships minimize data redundancy. Types of Relationships

Aspects of attributes: i. Columns: Attributes are visualized as the vertical columns in a database table. ii. Properties: They represent the characteristics or qualities of the real-world entities that the table models. iii. Domains: Each attribute is associated with a domain, which defines the type of data allowed in that attribute's column. iv. Schema: The collection of attributes (along with their domains) for a given relation forms the relation's schema, which describes its structure. v. Values: The intersection of an attribute and a tuple (row) is a single data value. Example: Consider a simple "Books" table: i. The attributes in this table are Title, Author, Year, and Genre. ii. The domain for Year might be positive integers. iii. Each row, such as the one for "The Great Gatsby," contains a value for each attribute, forming a tuple.

Conceptual Design In a relational model, conceptual design is a high-level, technology-independent phase that identifies the core entities (objects) and relationships between them, focusing on business requirements without implementation details. It's represented by simplified diagrams, like ER diagrams, to create a common understanding for both technical and non-technical stakeholders and serves as the foundation for subsequent logical and physical database design stages. Aspects of Conceptual Design i. High-Level View : It provides a big-picture overview of the data needed for a system, ignoring technical specifics like data types or storage structures. ii. Entity-Relationship (ER) Diagrams : These graphical tools are commonly used to visually depict the main data objects (entities) and how they are connected (relationships). iii. Focus on Business Needs : The design process starts by understanding and documenting the organization's business requirements and how they relate to data. iv. Technology Independence : The conceptual model is not tied to a specific database system, ensuring it's a universal blueprint for data. v. Communication Tool : It facilitates clear communication between technical team members, business analysts, and clients, establishing a shared vocabulary for data concepts. How it Works

  1. Identify Entities : Nouns that represent distinct real-world objects (e.g., Customer, Product, Order) are identified.
  2. Define Relationships :

Logical design in a relational model is the process of structuring data into tables (relations) with defined attributes (columns) and relationships, based on a conceptual data model, but without considering the physical implementation. It involves converting a conceptual model into a relational schema by mapping entities to tables, relationships to foreign keys, and attributes to columns, aiming to create a well-structured, non- redundant, and consistent database that accurately reflects business requirements. Aspects of Logical Design i. Transformation from Conceptual to Relational Model : The logical design takes the abstract concepts and relationships identified in a conceptual model (like an ER diagram) and translates them into the specific structures of a relational database. ii. Defining Tables : Entities from the conceptual model are transformed into tables (relations). iii. Defining Attributes and Columns : Attributes of entities become columns within the tables. iv. Establishing Keys :  Candidate Keys : These are sets of attributes that uniquely identify a row in a table.  Primary Keys : One candidate key is selected as the primary key for each table, which must be unique and irreducible.  Foreign Keys : Primary keys from one table are placed in other tables as foreign keys to establish and enforce relationships between the entities. v. Mapping Relationships :  One-to-Many : Often implemented by placing the primary key of the "one" side as a foreign key in the "many" side table.  Many-to-Many : Typically resolved by creating a new "associative entity" table that holds the primary keys from both related tables. vi. Ensuring Data Consistency : Foreign keys are crucial for maintaining data integrity and consistency, ensuring that relationships between entities are properly supported. vii. Independence from Physical Implementation :

The logical design focuses on the structure of the data and its relationships, not on how it will be physically stored or accessed on specific hardware. Goals of Logical Design i. Structured and Well-Organized Tables : The goal is to create tables that are well-structured and reflect the organization's business environment accurately. ii. Minimize Redundancy : Data should be stored in a non-redundant manner to prevent inconsistencies and save storage space. iii. Support Business Requirements : The design must effectively store and manage the business information. iv. Foundation for Physical Design : It provides a detailed blueprint for the next stage, the physical design, where physical storage and performance considerations are addressed. Introduction to Normalization Database normalization is a systematic process used in relational database design to organize data efficiently, primarily by reducing data redundancy and improving data integrity. This involves structuring a database according to a series of rules known as "normal forms."

Concepts in Normalization Normal Form Normals forms are defined structures for relations with set of constraints that relations must satisfy in order to detect data redundancy and correct anomalies. There can be following anomalies while performing a database operation:  insert: data is known but can not be inserted  update: updating data requires modifications in multiple tuples (rows)  delete: deleting some data causes some other data to be lost First Normal Form has initial constraints, further normal forms like 2NF, 3NF, BCNF, 4NF, 5NF would add new constraints cumulatively. In other words, every 2NF is also in 1NF; every relation in 3NF is also in 2NF. If all group of relations are represented as sets, following figure can be drawn:

First Normal Form (1NF) First normal form (1NF) is the simplest level of normalization. It involves ensuring that each table in the database has a primary key and that each column in the table contains atomic values. In other words, each row in the table should have a unique identifier, and each value in the table should be indivisible. Let’s take an example to understand this better. Consider a table that stores information about employees. The table might have columns like employee_id, name, address, and phone_number. However, the address column could contain multiple values, like street name, city, state, and zip code.

Third Normal Form (3NF) Third normal form (3NF) builds on the foundation of 2NF and involves ensuring that each non-key column in a table is not transitively dependent on the primary key. In other words, there should be no transitive dependencies in the table. Let’s take another example. Consider a table that stores information about books. The table might have columns like book_id, title, author, and publisher. However, the publisher column could be dependent on the author column, rather than on the book_id column. To bring this table to 3NF, we need to split it into two tables, one for book information and one for author information. Press enter or click to view image in full size 3NF Output