Feb 4: Recap of Jan 30 class Data Models: E-R and Relational (and some others of mostly historical interest) We examined the E-R model –Entities, Relationships,

Slides:



Advertisements
Similar presentations
Relational Database Design Via ER Modelling
Advertisements

Chapter 3 : Relational Model
Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the.
Relational Algebra Ch. 7.4 – 7.6 John Ortiz. Lecture 4Relational Algebra2 Relational Query Languages  Query languages: allow manipulation and retrieval.
The Relational Database Model
1 Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – EER Model –21th June.
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
The Relational Database Model
Chapter 3: Relational Model
Chapter 2: Entity-Relationship Model (Continued)
CPSC-608 Database Systems Fall 2011 Instructor: Jianer Chen Office: HRBB 315C Phone: Notes 1.
Database Design & ER Diagrams
Entity-Relationship Model
Chapter 41 Enhanced Entity-Relationship and Object Modeling.
3 The Relational Model MIS 304 Winter Class Objectives That the relational database model takes a logical view of data That the relational model’s.
The Relational Database Model
Databases Illuminated
Relational Model & Relational Algebra. 2 Relational Model u Terminology of relational model. u How tables are used to represent data. u Connection between.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 4 The Relational Model Pearson Education © 2014.
Relational Model Session 6 Course Name: Database System Year : 2012.
Chapter 4 The Relational Model.
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Chapter 3 Section 3.4 Relational Database Operators
Entity-Relationship Model
Chapter 3: Relational Model I Structure of Relational Databases Structure of Relational Databases Convert a ER Design to a Relational Database Convert.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
Chapter 3 The Relational Model. 2 Chapter 3 - Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between.
1 The Relational Model By Elena Ciriani CS157A February 19, 2004 Professor Lee.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj RM/SQL Lecture 1 ©Akhilesh Bajaj, 2000, 2002, 2003, All.
ICOM 5016 – Introduction to Database Systems Lecture 5b Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
1 The Relational Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
CIS552Relational Model1 Structure of Relational Database Relational Algebra Extended Relational-Algebra-Operations Modification of the Database.
M Taimoor Khan Course Objectives 1) Basic Concepts 2) Tools 3) Database architecture and design 4) Flow of data (DFDs)
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
Relational Model By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING COLLEGE TIRUVANNAMALAI.
Database Systems: Enhanced Entity-Relationship Modeling Dr. Taysir Hassan Abdel Hamid.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
Entity Relationship Diagram (2)
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Enhanced Entity-Relationship (EER) Modeling. Slide 4- 2 Chapter Outline EER stands for Enhanced ER or Extended ER EER Model Concepts Includes all modeling.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Computing & Information Sciences Kansas State University Friday, 26 Jan 2008CIS 560: Database System Concepts Lecture 2 of 42 Friday, 29 August 2008 William.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. – (customer-id, account-number)
Entity-Relation Model. E-R Model The Entity-Relationship (ER) model was originally proposed by Peter in 1976 ER model is a conceptual data model that.
Database and Information Retrieval System
Presented By: Miss N. Nembhard. Relation Algebra Relational Algebra is : the formal description of how a relational database operates the mathematics.
CSC271 Database Systems Lecture # 7. Summary: Previous Lecture  Relational keys  Integrity constraints  Views.
The Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
CST203-2 Database Management Systems Lecture 4. Student entity NIDFNameLNameRegNoExamIdBirthdate.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
CSCI 6315 Applied Database Systems Review for Midterm Exam I Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
Week 2 Lecture The Relational Database Model Samuel ConnSamuel Conn, Faculty Suggestions for using the Lecture Slides.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
Enhanced Entity-Relationship and UML Modeling. 2.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
IT 5433 LM2 ER & EER Model. Learning Objectives: Explain importance of data modeling Define and use the entity-relationship model Define E/R terms Describe.
Relational Model By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany)
Lecture 2 The Relational Model
Chapter 6: Entity-Relationship Model
Chapter 4 Relational Algebra
Presentation transcript:

Feb 4: Recap of Jan 30 class Data Models: E-R and Relational (and some others of mostly historical interest) We examined the E-R model –Entities, Relationships, and Attributes –Diagram-based model Talked about Keys Some special cases for the E-R model Today we’ll examine two enhancements of the E-R model that allow representation of some hierarchical information, then move on to the Relational database model.

Specialization-Generalization (ISA Hierarchy) This is a way to represent entity complexity specialization: top-down refinement of entities with distinct attributes –Entity type BANK ACCOUNT might be subdivided into related but different types CHECKING ACCT and SAVINGS ACCT generalization: bottom-up abstraction of common attributes –Course types DATABASE, SYSTEM, and NETWORK all have common attribute (project). From them we can abstract a new course type PRACTICAL COURSE –other common course attributes are included (e.g., course number)

ISA Hierarchy Example: Top-down Refinement Account entity with attributes balance and number additional complexity: we want to represent two subtypes of account –Savings Account with attribute Interest Rate –Checking Account with attribute Overdraft Limit

ISA Hierarchy Example: Bottom-up Abstraction Three related entities with similar attribute project we abstract a new type of super entity Practical Course and link the three entities as subtypes other shared attributes (e.g., course number) are also promoted to the upper level entity

Aggregation (Part-of Hierarchy) This is a way to represent relationship complexity –relationships among relationships are not supported by the E-R model –often we want to model lower-level relationships differently Groups of entities and relationships can be abstracted into higher level entities

Part-of Hierarchy Example Entities driver, car, tires, doors, engine, seats, piston, valves Relationship drives is insufficient to model the complexity of this system Part-of relationships allow abstraction into higher level entities (piston and valves as parts of engine; engine, tires, doors, seats aggregated into car)

Mapping an E-R Schema to Tables Motivation - translating E-R database designs into Relational designs –Both models are abstract, logical representations of a real-world enterprise –Both models employ similar design principles –Converting an E-R diagram to tables is the way we translate an E- R schema to a Relational schema. –Later on we’ll examine how to convert a Relational schema to an E-R schema

Mapping an E-R Schema to Tables (2) –Strong Entity E with primary key PK and attributes A, B, … ==> E(PK, A, B, …) –Weak Entity F with (non-primary) key WK and attributes C, D, … depending upon E above for primary key ==> F(PK, WK, C, D, …) –Relationship R with attributes L, M, … and associating Entities E (with primary key PK), E2 (PK2), E3 (PK3), … ==> R(PK, PK2, PK3, …, L, M, …) –Relationships between weak entities and the strong one on which they are dependent usually do not require representation because it is usually a many-one relationship with no attributes on the relationship (they are on the weak entity) and so the resulting table R(PK, WK) is a subset of the weak entity itself.

Table Details The whole table represents a single Entity Set or Relationship Set. Each entry (row) in the table corresponds to a single instance (member in that set) For an Entity Set each column in the table represents an attribute in the E-R diagram For a Relationship Set each column in the table represents either an attribute of the Relationship or one of the parts of the primary key of the Entity Sets it associates

Mapping an E-R Schema to Tables (3) –ISA relationships: choose either to Represent the super class entity, then represent each subclass with the primary key of the super class and its own attribute set. This is very similar to the way weak entities are treated. Or, map the subclasses to separate relations and ignore the whole super class. This is good when the subclasses partition the whole superclasses between them (the subclasses are disjoint and the union of the subclasses covers the whole super class). –Aggregate (part-of) relationship Translation is straightforward -- just treat the aggregate as an entity and use the methods defined above. –With last week’s lecture, this covers the material of chapter 2.

Relational Database Model Most popular logical data model Relations (also called tables) represent both Entity Sets and Relationship Sets. –Attributes form the columns of the table (column and attribute are synonymous) –Each row represents a single entity or relationship (called a row or tuple) Each instance of an attribute takes values from a specific set called the domain of the column (the domain defines the type)

Relational Database Model (cont) A relation schema is made up of the name and attributes of a relation with their underlying domains A database schema is a set of all relation schemas. The notions of keys, primary keys, superkeys are all as previously described

Query Languages a language in which a user requests information from the database –a higher level language than standard programming languages query languages may be procedural or non-procedural –procedural languages specify a series of operations on the database to generate the desired result –non-procedural languages do not specify how the information is generated –most commercial relational database systems offer a query language that includes procedural and non-procedural elements

Relational Algebra procedural query language set of operators that map one or more relations into another relation closed algebraic system –best feature - operations on operations –form relational algebraic expressions two types of operations: set-theoretic and database specific

Relational Algebra Operations database specific: –(horizontal) selection (  ) –(vertical) projection (  ) –join –outer join –semijoin –division set operators –union –difference –intersection –cartesian (cross) product

Example Relations EMPenamesalarydept Gary30Ktoy Shirley35Kcandy Christos37Kshoe Robin22Ktoy Uma30Kshoe Tim12K (null) DEPTdeptfloormgr candy1Irene toy2Jim men2John shoe1George

Database Specific Operators (horizontal) selection (  ) –picks a subset of the rows (vertical) projection (  ) –picks a subset of the columns join –creates a new relation (table) out of two equijoin (based upon equality of attributes) natural join (equijoin plus projection to eliminate duplicated columns)

Set Operators union –both relations must be union-compatible -- same degree and same domains set difference –both relations must be union-compatible as above intersection –same deal cartesian (cross) product –note similarity to join operation; join can be defined as a cross product followed by a selection criteria

More Operators rename (  ) –results of operations in the relational algebra do not have names –it is often useful to be able to name such results for use in further expressions later on –conceptually similar to an assignment operator in most programming languages semijoin –very useful in practical implementation of large queries –semijoin of R and S is equivalent to the join of R and S projected onto the attributes of R.