The Relational Model. Outline. Why Study the Relational Model? Faloutsos SCS object-relational model

Similar documents
The Relational Model. Roadmap. Relational Database: Definitions. Why Study the Relational Model? Relational database: a set of relations

Relational Databases BORROWED WITH MINOR ADAPTATION FROM PROF. CHRISTOS FALOUTSOS, CMU /615

The Relational Model. Chapter 3

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model 2. Week 3

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

Database Applications (15-415)

The Relational Model. Why Study the Relational Model? Relational Database: Definitions

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT )

Why Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages

Database Applications (15-415)

Data Modeling. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Introduction to Data Management. Lecture #4 (E-R Relational Translation)

Introduction to Data Management. Lecture #4 (E-R à Relational Design)

Database Systems ( 資料庫系統 )

The Relational Model (ii)

Review. The Relational Model. Glossary. Review. Data Models. Why Study the Relational Model? Why use a DBMS? OS provides RAM and disk

Relational data model

High-Level Database Models (ii)

CIS 330: Applied Database Systems. ER to Relational Relational Algebra

From ER to Relational Model. Book Chapter 3 (part 2 )

Database Management Systems. Chapter 3 Part 2

Introduction to Data Management. Lecture #5 Relational Model (Cont.) & E-Rà Relational Mapping

High Level Database Models

The Relational Model. Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC)

Database Systems. Course Administration

CIS 330: Applied Database Systems

The Relational Data Model. Data Model

Introduction to Data Management. Lecture #5 (E-R Relational, Cont.)

Administrivia. The Relational Model. Review. Review. Review. Some useful terms

The Entity-Relationship Model

The Relational Model. Week 2

The Relational Model

The Entity-Relationship Model. Overview of Database Design

The Relational Model of Data (ii)

Introduction to Data Management. Lecture #6 E-Rà Relational Mapping (Cont.)

Database Management Systems. Chapter 3 Part 1

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

Overview of db design Requirement analysis Data to be stored Applications to be built Operations (most frequent) subject to performance requirement

ER to Relational Mapping. ER Model: Overview

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

The Relational Model

CONCEPTUAL DESIGN: ER TO RELATIONAL TO SQL

Introduction to Data Management. Lecture #3 (E-R Design, Cont d.)

Comp 5311 Database Management Systems. 4b. Structured Query Language 3

LAB 3 Notes. Codd proposed the relational model in 70 Main advantage of Relational Model : Simple representation (relationstables(row,

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

Database Management Systems. Session 2. Instructor: Vinnie Costa

OVERVIEW OF DATABASE DEVELOPMENT

Database Design & Deployment

CompSci 516 Database Systems. Lecture 2 SQL. Instructor: Sudeepa Roy

Introduction to Database Design

Contents. Database. Information Policy. C03. Entity Relationship Model WKU-IP-C03 Database / Entity Relationship Model

Introduction to Databases

Lecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems

Conceptual Design. The Entity-Relationship (ER) Model

The Relational Model. Database Management Systems

Introduction to Database Design

Introduction to Database Design

CSE 530A. ER Model to Relational Schema. Washington University Fall 2013

MIS Database Systems Entity-Relationship Model.

COMP Instructor: Dimitris Papadias WWW page:

Database Applications (15-415)

Lecture 2 SQL. Announcements. Recap: Lecture 1. Today s topic. Semi-structured Data and XML. XML: an overview 8/30/17. Instructor: Sudeepa Roy

Introduction to Database Design. Dr. Kanda Runapongsa Dept of Computer Engineering Khon Kaen University

The Entity-Relationship Model

The Relational Model

Conceptual Design. The Entity-Relationship (ER) Model

CSC 261/461 Database Systems Lecture 10

Translating an ER Diagram to a Relational Schema

The Entity-Relationship (ER) Model 2

The Entity-Relationship (ER) Model

The Entity-Relationship Model

Entity-Relationship Diagrams

Database Applications (15-415)

Database Design. ER Model. Overview. Introduction to Database Design. UVic C SC 370. Database design can be divided in six major steps:

The Entity-Relationship Model. Overview of Database Design. ER Model Basics. (Ramakrishnan&Gehrke, Chapter 2)

DBMS. Relational Model. Module Title?

CS275 Intro to Databases

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

Keys, SQL, and Views CMPSCI 645

Overview. Introduction to Database Design. ER Model. Database Design

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

Introduction to Data Management. Lecture #3 (Conceptual DB Design) Instructor: Chen Li

ER Model Overview. The Entity-Relationship Model. Database Design Process. ER Model Basics

Announcements If you are enrolled to the class, but have not received the from Piazza, please send me an . Recap: Lecture 1.

CIS 330: Web-driven Web Applications. Lecture 2: Introduction to ER Modeling

CS/INFO 330 Entity-Relationship Modeling. Announcements. Goals of This Lecture. Mirek Riedewald

Database Management Systems. Chapter 2 Part 2

Integrity constraints, relationships. CS634 Lecture 2

CSIT5300: Advanced Database Systems

The Entity-Relationship Model. Steps in Database Design

CSE 530A. ER Model. Washington University Fall 2013

L3 The Relational Model. Eugene Wu Fall 2018

CSC 261/461 Database Systems Lecture 8. Spring 2018

VARDHAMAN COLLEGE OF ENGINEERING Shamshabad , Hyderabad B.Tech. CSE IV Semester (VCE - R11) T P C 3+1* -- 4 (A1511) DATABASE MANAGEMENT SYSTEMS

Introduction to Data Management. Lecture #4 E-R Model, Still Going

The Relational Model Constraints and SQL DDL

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

Transcription:

The Relational Model CMU SCS 15-415 C. Faloutsos Lecture #3 R & G, Chap. 3 Outline Introduction Integrity constraints (IC) Enforcing IC Querying Relational Data ER to tables Intro to Views Destroying/altering tables Faloutsos 15-415 2 Why Study the Relational Model? Most widely used model. Vendors: IBM/Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models e.g., IBM s IMS Object-oriented concepts have recently merged in object-relational model Informix->IBM DB2, Oracle 8i Faloutsos 15-415 3 1

Relational Database: Definitions Relational database: a set of relations (relation = table) specifically Faloutsos 15-415 4 Relational Database: Definitions Relation: made up of 2 parts: Schema : specifies name of relation, plus name and type of each column. Instance : a table, with rows and columns. #rows = cardinality #fields = degree / arity Faloutsos 15-415 5 Relational Database: Definitions relation: a set of rows or tuples. all rows are distinct no order among rows (why?) Faloutsos 15-415 6 2

Ex: Instance of Students Relation Cardinality = 3, arity = 5, all rows distinct Q: do values in a column need to be distinct? Faloutsos 15-415 7 SQL - A language for Relational DBs SQL * (a.k.a. Sequel ), standard language Data Definition Language (DDL) create, modify, delete relations specify constraints administer users, security, etc. * Structured Query Language Faloutsos 15-415 8 SQL - A language for Relational DBs Data Manipulation Language (DML) Specify queries to find tuples that satisfy criteria add, modify, remove tuples Faloutsos 15-415 9 3

SQL Overview CREATE TABLE <name> ( <field> <domain>, ) INSERT INTO <name> (<field names>) VALUES (<field values>) DELETE FROM <name> WHERE <condition> Faloutsos 15-415 10 SQL Overview UPDATE <name> SET <field name> = <value> WHERE <condition> SELECT <fields> FROM <name> WHERE <condition> Faloutsos 15-415 11 Creating Relations in SQL Creates the Students relation. CREATE TABLE Students (sid CHAR(20), name CHAR(20), login CHAR(10), age INTEGER, gpa FLOAT) Faloutsos 15-415 12 4

Creating Relations in SQL Creates the Students relation. Note: the type (domain) of each field is specified, and enforced by the DBMS whenever tuples are added or modified. Faloutsos 15-415 13 Table Creation (continued) Another example: CREATE TABLE Enrolled (sid CHAR(20), cid CHAR(20), grade CHAR(2)) Faloutsos 15-415 14 Adding and Deleting Tuples Can insert a single tuple using: INSERT INTO Students (sid, name, login, age, gpa) VALUES ( 53688, Smith, smith@cs, 18, 3.2) Faloutsos 15-415 15 5

Adding and Deleting Tuples Can delete all tuples satisfying some condition (e.g., name = Smith): DELETE FROM Students S WHERE S.name = Smith Powerful variants of these commands: more later! Faloutsos 15-415 16 Outline Introduction Integrity constraints (IC) Enforcing IC Querying Relational Data ER to tables Intro to Views Destroying/altering tables Faloutsos 15-415 17 Keys Keys help associate tuples in different relations Keys are one form of integrity constraint (IC) Enrolled Students Faloutsos 15-415 18 6

Keys Keys help associate tuples in different relations Keys are one form of integrity constraint (IC) Enrolled Students FOREIGN Key PRIMARY Key Faloutsos 15-415 19 Primary Keys A set of fields is a superkey if: No two distinct tuples can have same values in all key fields A set of fields is a key for a relation if : minimal superkey Faloutsos 15-415 20 Primary Keys what if >1 key for a relation? Faloutsos 15-415 21 7

Primary Keys what if >1 key for a relation? one of the keys is chosen (by DBA) to be the primary key. Other keys are called candidate keys.. Q: example? Faloutsos 15-415 22 Primary Keys E.g. sid is a key for Students. What about name? The set {sid, gpa} is a superkey. Faloutsos 15-415 23 Primary and Candidate Keys in SQL Possibly many candidate keys (specified using UNIQUE), one of which is chosen as the primary key. Keys must be used carefully! For a given student and course, there is a single grade. Faloutsos 15-415 24 8

Primary and Candidate Keys in SQL CREATE TABLE Enrolled (sid CHAR(20) cid CHAR(20), vs. grade CHAR(2), PRIMARY KEY (sid,cid)) CREATE TABLE Enrolled (sid CHAR(20) cid CHAR(20), grade CHAR(2), PRIMARY KEY (sid), UNIQUE (cid, grade)) Faloutsos 15-415 25 Primary and Candidate Keys in SQL CREATE TABLE Enrolled (sid CHAR(20) cid CHAR(20), vs. grade CHAR(2), PRIMARY KEY (sid,cid)) CREATE TABLE Enrolled (sid CHAR(20) cid CHAR(20), grade CHAR(2), PRIMARY KEY (sid), UNIQUE (cid, grade)) Q: what does this mean? Faloutsos 15-415 26 Primary and Candidate Keys in SQL CREATE TABLE Enrolled (sid CHAR(20) cid CHAR(20), vs. grade CHAR(2), PRIMARY KEY (sid,cid)) CREATE TABLE Enrolled (sid CHAR(20) cid CHAR(20), grade CHAR(2), PRIMARY KEY (sid), UNIQUE (cid, grade)) Students can take only one course, and no two students in a course receive the same grade. Faloutsos 15-415 27 9

Foreign Keys Enrolled Students Faloutsos 15-415 28 Foreign Keys, Referential Integrity Foreign key : Set of fields `refering to a tuple in another relation. Must correspond to the primary key of the other relation. Like a `logical pointer. foreign key constraints enforce referential integrity (i.e., no dangling references.) Faloutsos 15-415 29 Foreign Keys in SQL Example: Only existing students may enroll for courses. sid is a foreign key referring to Students: Enrolled Students Faloutsos 15-415 30 10

Foreign Keys in SQL CREATE TABLE Enrolled (sid CHAR(20),cid CHAR(20),grade CHAR(2), PRIMARY KEY (sid,cid), FOREIGN KEY (sid) REFERENCES Students ) Enrolled Students Faloutsos 15-415 31 Outline Introduction Integrity constraints (IC) Enforcing IC Querying Relational Data ER to tables Intro to Views Destroying/altering tables Faloutsos 15-415 32 Enforcing Referential Integrity Subtle issues: What should be done if an Enrolled tuple with a non-existent student id is inserted? Enrolled Students Faloutsos 15-415 33 11

Enforcing Referential Integrity Subtle issues: What should be done if an Enrolled tuple with a non-existent student id is inserted? (Reject it!) Faloutsos 15-415 34 Enforcing Referential Integrity Subtle issues, cont d: What should be done if a Student s tuple is deleted? Enrolled Students Faloutsos 15-415 35 Enforcing Referential Integrity Subtle issues, cont d: What should be done if a Students tuple is deleted? Also delete all Enrolled tuples that refer to it? Disallow deletion of a Students tuple that is referred to? Set sid in Enrolled tuples that refer to it to a default sid? (In SQL, also: Set sid in Enrolled tuples that refer to it to a special value null, denoting `unknown or `inapplicable.) Faloutsos 15-415 36 12

Enforcing Referential Integrity Similar issues arise if primary key of Students tuple is updated. Faloutsos 15-415 37 Integrity Constraints (ICs) IC: condition that must be true for any instance of the database; e.g., domain constraints. ICs are specified when schema is defined. ICs are checked when relations are modified. Faloutsos 15-415 38 Integrity Constraints (ICs) A legal instance of a relation: satisfies all specified ICs. DBMS should not allow illegal instances. we prefer that ICs are enforced by DBMS (as opposed to?) Blocks data entry errors, too! Faloutsos 15-415 39 13

Where do ICs Come From? Faloutsos 15-415 40 Where do ICs Come From? the application! Faloutsos 15-415 41 Where do ICs Come From? Subtle point: We can check a database instance to see if an IC is violated, but we can NEVER infer that an IC is true by looking at an instance. An IC is a statement about all possible instances! From example, we know name is not a key, but the assertion that sid is a key is given to us. Faloutsos 15-415 42 14

Where do ICs Come From? Key and foreign key ICs are the most common; more general ICs supported too. Faloutsos 15-415 43 Outline Introduction Integrity constraints (IC) Enforcing IC Querying Relational Data ER to tables Intro to Views Destroying/altering tables Faloutsos 15-415 44 ER to tables outline: strong entities weak entities (binary) relationships 1-to-1, 1-to-many, etc total/partial participation ternary relationships ISA-hierarchies aggregation Faloutsos 15-415 45 15

Logical DB Design: ER to Relational (strong) entity sets to tables. name ssn lot Employees Faloutsos 15-415 46 Logical DB Design: ER to Relational (strong) entity sets to tables. name ssn lot Employees CREATE TABLE Employees (ssn CHAR(11), name CHAR(20), lot INTEGER, PRIMARY KEY (ssn)) Faloutsos 15-415 47 Relationship Sets to Tables Many-to-many: name since dname ssn lot did budget Employees Works_In Departments Faloutsos 15-415 48 16

Relationship Sets to Tables Many-to-many: name since dname ssn lot did budget Employees Works_In Departments Faloutsos 15-415 49 Relationship Sets to Tables key of many-to-many relationships: Keys from participating entity sets (as foreign keys). CREATE TABLE Works_In( ssn CHAR(11), did INTEGER, since DATE, PRIMARY KEY (ssn, did), FOREIGN KEY (ssn) REFERENCES Employees, FOREIGN KEY (did) REFERENCES Departments) Faloutsos 15-415 50 1-to-many: Review: Key Constraints in ER name since dname ssn lot did budget Employees Manages Departments Faloutsos 15-415 51 17

Review: Key Constraints in ER 1-to-1 Many-to-1 1-to Many Many-to-Many Faloutsos 15-415 52 ER to tables - summary of basics strong entities: key -> primary key (binary) relationships: get keys from all participating entities - pr. key: 1-to-1 -> either key (other: cand. key ) 1-to-N -> the key of the N part M-to-N -> both keys Faloutsos 15-415 53 A subtle point (1-to-many) name since dname ssn lot did budget Employees Manages Departments Faloutsos 15-415 54 18

Translating ER with Key Constraints since name dname ssn lot did budget Employees Manages Departments CREATE TABLE Manages( ssn CHAR(11), did INTEGER, since DATE, PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees, FOREIGN KEY (did) REFERENCES Departments) CREATE TABLE Departments( did INTEGER), dname CHAR(20), budget REAL, PRIMARY KEY (did), ) Two-table-solution Faloutsos 15-415 55 Translating ER with Key Constraints since name dname ssn lot did budget Employees Manages Departments CREATE TABLE Dept_Mgr( ssn CHAR(11), did INTEGER, since DATE, dname CHAR(20), budget REAL, PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees) Single-table-solution Faloutsos 15-415 56 Translating ER with Key Constraints since name dname ssn lot did budget Employees Manages Departments CREATE TABLE Manages( ssn CHAR(11), did INTEGER, since DATE, Vs. PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees, FOREIGN KEY (did) REFERENCES Departments) CREATE TABLE Dept_Mgr( ssn CHAR(11), did INTEGER, since DATE, dname CHAR(20), budget REAL, PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees) Faloutsos 15-415 57 19

Pros and cons? Faloutsos 15-415 58 Drill: What if the toy department has no manager (yet)? CREATE TABLE Dept_Mgr( did INTEGER, dname CHAR(20), budget REAL, ssn CHAR(11), since DATE, PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees) Faloutsos 15-415 59 ER to tables outline: strong entities weak entities (binary) relationships 1-to-1, 1-to-many, etc total/partial participation ternary relationships ISA-hierarchies aggregation Faloutsos 15-415 60 20

Review: Participation Constraints Does every department have a manager? If so, this is a participation constraint: the participation of Departments in Manages is said to be total (vs. partial). Every did value in Departments table must appear in a row of the Manages table (with a non-null ssn value!) ssn name lot since did dname budget Employees Manages Departments Works_In since Faloutsos 15-415 61 Participation Constraints in SQL We can capture participation constraints involving one entity set in a binary relationship, but little else (without resorting to CHECK constraints). CREATE TABLE Dept_Mgr( did INTEGER, dname CHAR(20), budget REAL, ssn CHAR(11) NOT NULL, since DATE, PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees, ON DELETE NO ACTION) Faloutsos 15-415 62 Participation Constraints in SQL Total participation ( no action -> do NOT do the delete) Ie, a department MUST have a nanager CREATE TABLE Dept_Mgr( did INTEGER, dname CHAR(20), budget REAL, ssn CHAR(11) NOT NULL, since DATE, PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees, ON DELETE NO ACTION) Faloutsos 15-415 63 21

Participation Constraints in SQL Partial partipation, ie, a department may be headless CREATE TABLE Dept_Mgr( did INTEGER, dname CHAR(20), budget REAL, ssn CHAR(11) NOT NULL, since DATE, PRIMARY KEY (did), FOREIGN KEY (ssn) REFERENCES Employees, ON DELETE SET NULL) Faloutsos 15-415 64 ER to tables outline: strong entities weak entities (binary) relationships 1-to-1, 1-to-many, etc total/partial participation ternary relationships ISA-hierarchies aggregation Faloutsos 15-415 65 Review: Weak Entities A weak entity can be identified uniquely only by considering the primary key of another (owner) entity. Owner entity set and weak entity set must participate in a one-to-many relationship set (1 owner, many weak entities). Weak entity set must have total participation in this identifying relationship set. ssn name lot cost dname age Employees Policy Dependents Faloutsos 15-415 66 22

Review: Weak Entities How to turn Dependents into a table? ssn name lot cost dname age Employees Policy Dependents Faloutsos 15-415 67 Translating Weak Entity Sets Weak entity set and identifying relationship set are translated into a single table. CREATE TABLE Dep_Policy ( dname CHAR(20), age INTEGER, cost REAL, ssn CHAR(11) NOT NULL, PRIMARY KEY (dname, ssn), FOREIGN KEY (ssn) REFERENCES Employees, ON DELETE CASCADE) Faloutsos 15-415 68 Translating Weak Entity Sets Weak entity set and identifying relationship set are translated into a single table. When the owner entity is deleted, all owned weak entities must also be deleted (-> CASCADE ) CREATE TABLE Dep_Policy ( dname CHAR(20), age INTEGER, cost REAL, ssn CHAR(11) NOT NULL, PRIMARY KEY (dname, ssn), FOREIGN KEY (ssn) REFERENCES Employees, ON DELETE CASCADE) Faloutsos 15-415 69 23

ER to tables outline: strong entities weak entities (binary) relationships 1-to-1, 1-to-many, etc total/partial participation ternary relationships ISA-hierarchies aggregation Faloutsos 15-415 70 ssn name lot Review: ISA Hierarchies Employees hourly_wages hours_worked ISA contractid Hourly_Emps Contract_Emps Overlap constraints: Can Joe be an Hourly_Emps as well as a Contract_Emps entity? (Allowed/disallowed) Covering constraints: Does every Employees entity also have to be an Hourly_Emps or a Contract_Emps entity? (Yes/no) Faloutsos 15-415 71 Drill: What would you do? ssn name lot Employees hourly_wages hours_worked ISA contractid Hourly_Emps Contract_Emps Faloutsos 15-415 72 24

Translating ISA Hierarchies to Relations General approach: 3 relations: Employees, Hourly_Emps and Contract_Emps. how many times do we record an employee? what to do on deletion? how to retrieve all info about an employee? EMP (ssn, name, lot) H_EMP(ssn, h_wg, h_wk) CONTR(ssn, cid) Faloutsos 15-415 73 Translating ISA Hierarchies to Relations Alternative: Just Hourly_Emps and Contract_Emps. Hourly_Emps: ssn, name, lot, hourly_wages, hours_worked. Each employee must be in one of these two subclasses. EMP (ssn, name, lot) H_EMP(ssn, h_wg, h_wk, name, lot) CONTR(ssn, cid, name, lot) Notice: black is gone! Faloutsos 15-415 74 ER to tables outline: strong entities weak entities (binary) relationships 1-to-1, 1-to-many, etc total/partial participation ternary relationships ISA-hierarchies aggregation Faloutsos 15-415 75 25

Ternary relationships; aggregation rare keep keys of all participating entity sets (or: avoid such situations: break into 2-way relationships or add an auto-generated key ) Faloutsos 15-415 76 Outline Introduction Integrity constraints (IC) Enforcing IC Querying Relational Data ER to tables Intro to Views Destroying/altering tables Faloutsos 15-415 77 Views Virtual tables CREATE VIEW YoungActiveStudents (name,grade) AS SELECT S.name, E.grade FROM Students S, Enrolled E WHERE S.sid=E.sid and S.age<21 DROP VIEW Faloutsos 15-415 78 26

Views and Security DBA: grants authorization to a view for a user user can only see the view - nothing else Faloutsos 15-415 79 Outline Introduction Integrity constraints (IC) Enforcing IC Querying Relational Data ER to tables Intro to Views Destroying/altering tables Faloutsos 15-415 80 Table changes DROP TABLE ALTER TABLE, e.g. ALTER TABLE students ADD COLUMN maiden-name CHAR(10) Faloutsos 15-415 81 27

Relational Model: Summary A tabular representation of data. Simple and intuitive, currently the most widely used Object-relational variant gaining ground Integrity constraints can be specified by the DBA, based on application semantics. DBMS checks for violations. Two important ICs: primary and foreign keys also: not null, unique In addition, we always have domain constraints. Mapping from ER to Relational is (fairly) straightforward: Faloutsos 15-415 82 ER to tables - summary of basics strong entities: key -> primary key (binary) relationships: get keys from all participating entities - pr. key: 1:1 -> either key 1:N -> the key of the N part M:N -> both keys weak entities: strong key + partial key -> primary key... ON DELETE CASCADE Faloutsos 15-415 83 ER to tables - summary of advanced total/partial participation: NOT NULL; ON DELETE NO ACTION ternary relationships: get keys from all; decide which one(s) -> prim. key aggregation: like relationships ISA: 2 tables ( total coverage ) 3 tables (most general) Faloutsos 15-415 84 28