L8-2-S1 Misc Topics © M.E. Fayad 2002-2005 SJSU -- CmpE Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of.

Slides:



Advertisements
Similar presentations
Relational Model Reading: C&B, Chap 2, 3 & 4. Dept. of Computing Science, University of Aberdeen 2 In this lecture you will learn The concept of Model.
Advertisements

RELATIONAL DATABASES. Relational data Structure RELATION: Table with columns and rows ATTRIBUTE: Column of a relation DOMAIN: Set of allowable values.
CSC271 Database Systems Lecture # 5. Summary: Previous Lecture  Database languages  Functions of a DBMS  DBMS environment  Data models and their categories.
Relational Model (CB Chapter 4) CPSC 356 Database Ellen Walker Hiram College.
Chapter 3 CIS 458 Sungchul Hong
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
L3-5c-S1 Object Diagrams © M.E. Fayad SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department,
Relations The Relational Data Model John Sieg, UMass Lowell.
L16-S1 Object Diagrams 2003 SJSU -- CmpE Software Patterns Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering.
L28-S1 Interaction Diagrams 2003 SJSU -- CmpE Advanced Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
L19-S1 More on Class Diagrams 2003 SJSU -- CmpE Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I.
Lesson II The Relational Model © 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.
L3-5d-S1 Class Diagrams © M.E. Fayad SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
© M.E. Fayad SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering.
© M.E. Fayad SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering.
1 Minggu 2, Pertemuan 3 The Relational Model Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
© M.E. Fayad SJSU -- CmpE Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José.
L5-S1 Class Diagrams 2003 SJSU -- CmpE Software Patterns Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San.
L8-S1 CRC Cards 2003 SJSU -- CmpE Advanced Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College.
© M.E. Fayad SJSU -- CmpE Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José.
1 Pertemuan 04 MODEL RELASIONAL Matakuliah: >/ > Tahun: > Versi: >
© M.E. Fayad SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering.
© M.E. Fayad SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering.
L3-6b-S1 Sequence Diagrams © M.E. Fayad SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room.
Thomas Connolly and Carolyn Begg’s
Relational Database Management System A type of database in which records are stored in relational form is called relational database management system.
Database Architecture The Relational Database Model.
CSC271 Database Systems Lecture # 6. Summary: Previous Lecture  Relational model terminology  Mathematical relations  Database relations  Properties.
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.
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Relational Model Session 6 Course Name: Database System Year : 2012.
Chapter 4 The Relational Model.
Chapter 3 The Relational Model Transparencies Last Updated: Pebruari 2011 By M. Arief
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 Database Model. 2 Learning Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical.
9/7/2012ISC329 Isabelle Bichindaritz1 The Relational Database Model.
The Relational Model Pertemuan 03 Matakuliah: M0564 /Pengantar Sistem Basis Data Tahun : 2008.
Relational Database. Database Management System (DBMS)
Announcements Reading for Monday –4.6 Homework 3 – Due 9/29.
12/2/2015CPSC , CPSC , Lecture 41 Relational Model.
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,
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
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
Chapter 4 The Relational Model Pearson Education © 2009.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
L1-S1 Infinite R-DB 2003 SJSU -- CmpE Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San.
The Relational Data Model and Relational Database Constraints
The Relational Model May Aldoayan.
Database Design Dr. M.E. Fayad, Professor
The Relational Database Model
Data Base System Lecture 6: Relational Model
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Object-Oriented Analysis & Design
DATABASE SYSTEM.
Chapter 4+17 The Relational Model Pearson Education © 2014.
Chapter 4 The Relational Model Pearson Education © 2009.
The Relational Model Transparencies
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Design tools and techniques for a relational database system
Chapter 4 The Relational Model Pearson Education © 2009.
Database Design Dr. M.E. Fayad, Professor
Software System Engineering
Chapter 3 The Relational Model
RELATIONAL DATA MODEL - 1
Presentation transcript:

L8-2-S1 Misc Topics © M.E. Fayad SJSU -- CmpE Database Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José State University One Washington Square San José, CA

L8-2-S2 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad 2 Lesson 08-2: Misc. Topics in DB

L8-2-S3 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad Lesson Objectives 3 Understand DB Terminology Explain Relation Properties Understand how to Identify Candidate, Primary, Alternate, and Foreign Keys Understand Entity Integrity and Referential Integrity

L8-2-S4 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad  External Level  View Level -- Users’ views of the db.  Conceptual Level  Logical View & Constraints View  Internal Level  Physical View or Computer’s view of the db. 4 Terminology: ANSI-SPARC Database Architecture

L8-2-S5 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad  A Relation is a table with columns & Rows.  An attribute is a named column of a relation.  A domain is the set of allowable values for one or more attributes.  A tuple is a row of a relation.  The degree of a relation is the number of attributes it contains. 5 More Terminology

L8-2-S6 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad 6 Example Branch branchNo street city postCode B Deer Rd London SW1 4EH B Post St Aberdeen AB2 3SU B S. Main St Glasgow GI1 9QX B Mo Ave Bristol BS9 1NX B Clover Dr London NW5 6EU staffNobranchNo B005 B007 B003 B004 B005 Staff Primary KeyForeign Key

L8-2-S7 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad  A Relation Schema – A named relation defined by a set of attribute and domain name pairs where: R (A1:d1, A2:d2, …., An:dn)  A Database Schema – A set of relation schema each with a distinct name. R = (R1, R2, ….., Rn) 7 More Terminology

L8-2-S8 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad  A relation has a name that is distinct from all other relation names within the same db.  Each cell of the relation contains exactly one atomic (single) value.  Each attribute has a distinct name.  The values of an attribute are all from the same domain. 8 Properties of Relations (1)

L8-2-S9 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad  Each tuple is distinct, there are no duplicate tuples.  The order of attributes has no significance.  The order of tuples has no significance, 9 Properties of Relations (2)

L8-2-S10 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad  Superkey – An attribute, or set of attributes, that uniquely identifies a tuple within a relation.  Candidate key – A Superkey, such that no proper subset is superkey within the relation.  A candidate key, k, for a relation R has two properties: 1)Uniqueness: In each tuple of R, the value of k uniquely identify the tuple. 2)Irreducibility – no proper subset of k has the uniqueness property 10 Relational Keys (1)

L8-2-S11 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad  They may be several candidate keys for a relation.  Composite key – A key consists of more than one attribute.  Exampes: 1)Do you think “city” in Branch relation is a candidate key? The answer is no. Why? Because London has two branch offices, therefore, the attribute “city” cannot be a candidate key. 2)Is “branchNo” a candidate key? Yes, Why? By Examining “branchNo”, each branch office has a unique branchNo, 3)Is postcode is a candidate key? Yes.. Why? 11 Relational Keys (2)

L8-2-S12 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad  Primary key: The candidate key that is selected to identify tuples uniquely within the relation  Alternate keys – The Candidate keys that are not selected to be the primary key.  Exampes: 1)In the Branch Relation, we can choose branchNo as the primary key and 2)Postcode as an alternate key. 12 Relational Keys (3)

L8-2-S13 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad 13 Relational Keys (4) –Foreign key: An attribute, or a set of attributes, with one relation that matches the candidate key of some (possibly the same) relation. –branchNo appeared in two relations: Branch and Saff relations –branchNo is a primary key in Branch relation and it is a foreign key in the Staff relation.

L8-2-S14 Misc Topics © M.E. Fayad SJSU – CmpE --- M.E. Fayad T/F 1.Each cell of the relation contains exactly on atomic (single) value. 2.Primary key is the candidate key that is selected to identify tuples uniquely within the database. 3.Foreign key is an attribute or a set of attributes within on relation that matches the candidate key of some relation. 4.The degree of a relation is the number of tuples it contains. 14 Discussion Questions