INFO 340 Lecture 3 Relational Databases. Based on the relational model, grounded in mathematic set theories. Three basic elements: Relation, Tuple, and.

Slides:



Advertisements
Similar presentations
The Relational Model and Relational Algebra Nothing is so practical as a good theory Kurt Lewin, 1945.
Advertisements

The Relational Model Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Relational Model (CB Chapter 4) CPSC 356 Database Ellen Walker Hiram College.
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Relations The Relational Data Model John Sieg, UMass Lowell.
Chapter 3. 2 Chapter 3 - Objectives Terminology of relational model. Terminology of relational model. How tables are used to represent data. How tables.
Relational Model Stores data as tables –Each column contains values about the same attribute –Each column has a distinct name –Each row contains values.
1 Minggu 2, Pertemuan 3 The Relational Model Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
1 Pertemuan 04 MODEL RELASIONAL Matakuliah: >/ > Tahun: > Versi: >
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.
1 Relational model concepts Key constraints Referential integrity constraint Steen Jensen, autumn 2013.
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.
Module Title? DBMS E-R Model to Relational Model.
44220: Database Design & Implementation Logical Data Modelling Ian Perry Room: C48 Tel Ext.: 7287
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
Relational Data Model. A Brief History of Data Models  1950s file systems, punched cards  1960s hierarchical  IMS  1970s network  CODASYL, IDMS 
CG084&085 / / 1 The Relational Data Model Properties of Relations Keys and Constraints.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
10/9/20151 The Relational Data Model TCU Database Systems Last update: September 2004 Reference: Elmasri 4 th edition, chapter 5.
Module 3: The Relational Model.  Overview Terminology Relational Data Structure Mathematical Relations Database Relations Relational Keys Relational.
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.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 – Relational Model.
Copyright © Curt Hill The Relational Model of Database Basic organization and terms.
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.
1 The Relational Model. 2 Why Study the Relational Model? v Most widely used model. – Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. v “Legacy.
The Relational Model Pertemuan 03 Matakuliah: M0564 /Pengantar Sistem Basis Data Tahun : 2008.
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor:
Relational Theory and Design
Announcements Reading for Monday –4.6 Homework 3 – Due 9/29.
12/2/2015CPSC , CPSC , Lecture 41 Relational Model.
1 CS 430 Database Theory Winter 2005 Lecture 4: Relational Model.
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
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,
April 20022CS3X1 Database Design The relational model John Wordsworth Department of Computer Science The University of Reading
Database Systems Logical Data Modelling Tutor:Ian Perry Tel: Web:
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
The relational model1 The relational model Mathematical basis for relational databases.
Mapping ER to Relational Model Each strong entity set becomes a table. Each weak entity set also becomes a table by adding primary key of owner entity.
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.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
The Relational Database Model
Data Modelling Introduction
Data Base System Lecture 6: Relational Model
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
02 - The Relational Database Model
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.
INSTRUCTOR: MRS T.G. ZHOU
Presentation transcript:

INFO 340 Lecture 3 Relational Databases

Based on the relational model, grounded in mathematic set theories. Three basic elements: Relation, Tuple, and Attributes (in SQL called Tables, Rows, Columns)

Core Relation Model NameDepartme nt PhoneDOBSex John White Managem ent x12091-Oct-45M Ann Beech Payrollx Nov- 60 F David Ford FinanceX Jul-72M Relation Attributes Tuple

Other Elements in the Relational Model Domain – Specifies the constraints placed upon an attribute or attributes. Degree – The number of attributes in a relation. Cardinality – Number of tuples in a relation. And finally…. Relational database – normalized collection of distinctly named relations.

Relational Keys Main goal is to ensure that each tuple can be uniquely identified. Assume there are 10,000 records in this database. What would be a good way to uniquely identify each row?

Relational Keys How about now? Other ways to uniquely identify -- Composite Key

Relational Keys Superkey - Any attribute set that uniquely identifies Candidate key - –Uniquely identifies –Irreducibility - can’t make it any smaller & still work Primary key - The candidate key that you choose to use Foreign key - An attribute (or set) in a table that matches the candidate key of another table. (Can be the same table).

Relational Keys

Mathematical Definition of Relation Consider two sets, D 1 & D 2, where D 1 = {2, 4} and D 2 = {1, 3, 5}. Cartesian product, D 1 X D 2, is set of all ordered pairs, where first element is member of D 1 and second element is member of D 2. D 1 X D 2 = {(2, 1), (2, 3), (2, 5), (4, 1), (4, 3), (4, 5)} Alternative way is to find all combinations of elements with first from D 1 and second from D 2.

Any subset of Cartesian product is a relation; e.g. R = {(2, 1), (4, 1)} May specify which pairs are in relation using some condition for selection; e.g. –second element is 1: R = {(x, y) | x ∈ D 1, y ∈ D 2, and y = 1} –first element is always twice the second: S = {(x, y) | x ∈ D 1, y ∈ D 2, and x = 2y} Mathematical Definition of Relation

Relational database model means relations between attributes A common misconception is that the “relational” in relational databases refers to the way one table relates to another table via foreign keys. This is not the case! Instead, it refers to the relation between attributes in a relation (table in DB speak).

Integrity Constraints Domain constraints - every attribute has an associated domain Integrity Rules Entity Integrity No attribute of primary key can be null Referential Integrity If a foreign key exists in a relation, it must ‘point’ to something -- ie there must be a candidate value in the home relation

Examples of Attribute Domains

NULL Used to indicate value unknown. This means it doesn’t work in normal comparisons. Null is not Zero or a blank string. Debate rages over whether or not to include NULL. –Opens up a relational model.. No longer closed. Was in E.F. Codd’s original specification

Null example Consider the following: What would the result of asking for rows where HourlyRate != 8.50 return? What about HourlyRate = 8.50 or HourlyRate != 8.50? NameHourlyRate Bob8.50 John12 SueNULL Alice8.50

Donald Rumsfeld, Feb 2002 news briefing “As we know, there are known knowns. There are things we know we know. We also know there are known unknowns. That is to say we know there are some things we do not know. But there are also unknown unknowns, the ones we don’t know we don’t know.”

Examples Cyber-Crime Attribution Database Law enforcement work is being done to identify relationships & patterns of activity with global malware-writers. A database needs to be built that tracks known malware writers, their locations, the nearest educational facility/institute, known aliases, known affiliations, etc. It also must track known malware & its types, ie trojan, worm, rootkit, its size etc. It must track which computers have been attacked, what types they are, what their OS’s are, where they were located at the time of attack, the time of attack itself, the IP addresses and domain names of the boxes. Were the victims firewalled? What type of firewall – built in, external hardware, etc. What was the patch level at the time of attack? Were updates running? How many search engine references are there to this code name? Break this down by specific search engine.

Class Activity Divide into 5 groups (approx people) Give yourself a group name Take 15 minutes to come up with scenario requiring a database. Write it down legibly. –Name 3 canned queries that the database must be able to solve. Write these down as well. At the end of 15 minutes, the first group will give their scenario to the next group. The receiving group will: –On the board, create an ERD with: field names & data types An identified primary key

Homework 1 Due Tue 1/14/08 Page Questions: –3.3, 3.4, 3.5, 3.8 Page 110 – Questions: –4.1, 4.8, 4.9