1 Presentation by Irina Kogan. November 27, 2000. Presentation by Irina Kogan. November 27, 2000.

Slides:



Advertisements
Similar presentations
Complex Integrity Constraints in SQL. Constraints over a Single Table Table Constraint: Create TABLE Sailors (sid INTEGER, sname CHAR(10), rating INTEGER,
Advertisements

Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
1 CHAPTER 4 RELATIONAL ALGEBRA AND CALCULUS. 2 Introduction - We discuss here two mathematical formalisms which can be used as the basis for stating and.
Database Management System Module 3:. Complex Constraints In this we specify complex integrity constraints included in SQL. It relates to integrity constraints.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A Modified by Donghui Zhang.
1 Lecture 11: Basic SQL, Integrity constraints
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 SQL: Queries, Constraints, Triggers Chapter 5.
Database Management Systems 1 Raghu Ramakrishnan SQL: Queries, Programming, Triggers Chpt 5.
SQL Constraints and Triggers
Database Management Systems, R. Ramakrishnan and J. Gehrke1 SQL: Queries, Programming, Triggers Chapter 5.
CMPT 258 Database Systems SQL: Queries, Constraints, Triggers (Chapter 5) Part II home.manhattan.edu/~tina.tian.
Chapter 4 Conceptual Modeling of Databases with Entity-Relationship Diagrams and the Unified Modeling Language.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Database Management Systems I Alex Coman, Winter 2006 Entity-Relationship.
Cs3431 Constraints Sections 6.1 – 6.5. cs3431 Example CREATE TABLE Student ( sNum int, sName varchar (20), prof int, CONSTRAINT pk PRIMARY KEY (snum),
Databases Revision.
SPRING 2004CENG 3521 The Relational Model Chapter 3.
Rutgers University SQL: Queries, Constraints, Triggers 198:541 Rutgers University.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
1 Data Modeling Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 SQL: Queries, Constraints, Triggers Chapter 5.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 157 Database Systems I SQL Constraints and Triggers.
CSCD343- Introduction to databases- A. Vaisman1 Relational Algebra.
CSC343 – Introduction to Databases - A. Vaisman1 SQL: Queries, Programming, Triggers.
ER to Relational Mapping. Logical DB Design: ER to Relational Entity sets to tables. CREATE TABLE Employees (ssn CHAR (11), name CHAR (20), lot INTEGER,
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
The Relational Model. Review Why use a DBMS? OS provides RAM and disk.
1 Translating E/R Diagrams into Relational Schemas.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L6_SQL(1) 1 SQL: Queries, Constraints, Triggers Chapter 5 – Part 1.
PLUG IT IN 3 Fundamentals of Relational Database Operations.
Chapter 3: Relational Model  Structure of Relational Databases  Normal forms (chap. 7)  Reduction of an E-R Schema to Relational (Sect. 2.9)  Relational.
1 The Relational Model. 2 Why Study the Relational Model? v Most widely used model. – Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. v “Legacy.
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
1 SQL: Constraints and Triggers Chapter 5,
SQL: Queries, Programming, Triggers. Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for.
ICS 321 Fall 2009 SQL: Queries, Constraints, Triggers Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/8/20091Lipyeow.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra.
1 Session 2 Welcome: The seventh learning sequence “ Reduction of an EER schema to tables“ Recap : In the previous learning sequence, we discussed the.
IS 230Lecture 4Slide 1 Entity Relationship to Relational Model Mapping Lecture 5.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 SQL: Constraints and Triggers Chapter 5,
Constraints, Triggers and Views COMSATS INSTITUTE OF INFORMATION TECHNOLOGY, VEHARI.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
Entity Relationship Diagram (2)
In this session, you will learn to: Map an ER diagram to a table Objectives.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 4 Relational Algebra.
CSCD34-Data Management Systems - A. Vaisman1 Relational Algebra.
Lecture 03 Entity-Relationship Diagram. Chapter Outline.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 5 SQL.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Data Modeling AND ER MODELS.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Basic SQL Queries.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
SQL – Part 2.
COP Introduction to Database Structures
Entity-Relationship Model
Relational Algebra Chapter 4, Part A
CSCI 6315 Applied Database Systems – Exercise (1)
SQL: Structured Query Language (‘Sequel’)
From ER to Relational Model
CS 405G: Introduction to Database Systems
SQL: The Query Language Part 1
Presentation transcript:

1 Presentation by Irina Kogan. November 27, Presentation by Irina Kogan. November 27, 2000.

2 Background 4 Business Object Notation (BON) –object-oriented modeling language (classes and objects) –inheritance, association, aggregation, constraints expressed in class invariants –two notations: textual and graphical 4 Relational Databases –What does a relation consist of? relational instance (table) relational schema describing the column heads for the table –Entity-Relationship (ER) diagrams and SQL structural constraints, check constraints, assertions, triggers

3 Motivation 4 Objects have identity, state, and behaviour in addition to data. 4 A relational database stores data only. 4 In spite of these differences, a relational database as well as BON have strong mechanisms for expressing semantic constraints. 4 As the importance of databases and people’s reliance on them have grown, a mapping strategy built on a solid understanding of the similarities and differences of these models is more needed than ever.

4 Inheritance (BON -> ER) : :

5 Association (BON -> ER) 4 3 possibilities for mapping associations: many-to-many many-to-one one-to-one relationships 4 Example:..

6 Mapping class invariants to check constraints 4 Example (uses the association diagrams on the previous slide): –Specify the following constraints (in BON and in SQL): a sailor’s rating must be an integer in the range 1 to 10 no sailor can reserve a green boat

7 Mapping class invariants to check constraints (cont’d) CREATE TABLE Reserves (sid INTEGER, bid INTEGER, day DATE, PRIMARY KEY (sid, bid), FOREIGN KEY (sid) REFERENCES Sailors, FOREIGN KEY(bid) REFERENCES Boats, CONSTRAINT NoGreenBoats CHECK (‘green’ <> (SELECT B.color FROM Boats B WHERE B.bid = Reserves.bid))) CREATE TABLE Reserves (sid INTEGER, bid INTEGER, day DATE, PRIMARY KEY (sid, bid), FOREIGN KEY (sid) REFERENCES Sailors, FOREIGN KEY(bid) REFERENCES Boats, CONSTRAINT NoGreenBoats CHECK (‘green’ <> (SELECT B.color FROM Boats B WHERE B.bid = Reserves.bid))) Simple check constraints : CREATE TABLE Sailors (sid INTEGER, name CHAR(15), rating INTEGER, PRIMARY KEY(sid), CHECK (rating >= 1 and rating <= 10)) CREATE TABLE Sailors (sid INTEGER, name CHAR(15), rating INTEGER, PRIMARY KEY(sid), CHECK (rating >= 1 and rating <= 10)) Check constraints involving queries : Many-to-many relationship => 1 class -> 2 tables

8 Additional mapping strategies 4 Aggregation -> weak entities 4 Clusters -> aggregation in ER-diagrams (no direct correspondence in all cases) 4 Specifying state change: use of the keyword old in BON, use of triggers in SQL 4 Mapping was also successful for: bidirectional links self references 4 Note: use object ids (OIDs) for primary keys tables are persistent objects void is similar to null (except for void references) message passing can be modelled via triggers in some cases

9 Summary 4 Many people believe that relational databases will evolve in time and that the vast majority of organizations will start mapping objects to relational databases. 4 This research has proven that most of semantic constraints expressed in BON can be successfully mapped to those in relational databases. The additional work described in the literature read on the subject has shown that objects themselves can be mapped successfully.