Chapter 3. The Relational Model. Database Systems p. 61/569
|
|
- Myron Chase
- 6 years ago
- Views:
Transcription
1 Chapter 3 The Relational Model Database Systems p. 61/569
2 Introduction The relational model was developed by E.F. Codd in the 1970s (he received the Turing award for it) One of the most widely-used data models Superseded the hierarchical and network models It was/is being extended with object-oriented and semistructured (XML) concepts Database Systems p. 62/569
3 Basic Definition A relational database contains a set of relations A relation R consists of two parts: An instance R, which is a table with rows and columns Represents the current content of this table A schema R which specifies the name of the relation and the names and data types of the columns Defines the structure of the table Database Systems p. 63/569
4 Example of an Instance Assume we want to keep information on students in the relationstudent: attribute stud_no name date_of_birth 1 Smith, John tuple 2 Miller, Anne Jones, Betty We call the rows tuples We call the columns attributes Database Systems p. 64/569
5 Schema of the Relation Student student has three attributes: stud no,name, and date of birth We associate a domain, or data type, with each attribute D stud_no = integer D name = string D date_of_birth = date So the complete schema looks like this: student(stud_no:integer, name:string, date_of_birth:date) Database Systems p. 65/569
6 Schema Information Schema information is also called metadata It is not the actual data but a description of what the data looks like Database Systems p. 66/569
7 More Definitions A relation (instance) is a subset of the Cartesian product of the domains R D 1 D 2 D n For example, student D stud_no D name D date_of_birth = student integer string date Database Systems p. 67/569
8 Even More Definitions The cardinality of a relation is its size in number of tuples A minimal set of attributes whose values uniquely identify a tuple is called a key Usually, the primary key is underlined student(stud_no, name, date_of_birth) Database Systems p. 68/569
9 Converting ER Relational If you want to implement your database using a relational system and you have an ER diagram you can convert this diagram into a relational schema! This is done in three steps: Converting entities Converting relationships Simplifying the schema Database Systems p. 69/569
10 Converting Entities Every entity is transformed into a separate relation Every attribute of the entity becomes an attribute in the relation Choose the key attribute(s) of the entity as primary key of the relation stud_no name date of birth student student(stud_no, name, date_of_birth) Database Systems p. 70/569
11 Converting Relationships Every relationship is transformed into a separate relation Attributes of this relation are made up of the keys of the participating entity relations + any attributes of the relationship (e.g. grade of the relationshipexamines) What is the key of this relation? Database Systems p. 71/569
12 Converting Relationships(2) The multiplicity of a relationship determines the key N:M the key is a combination of both entity keys 1:N, N:1 key of the entity on the N-side becomes key 1:1 choose one of the entity keys (arbitrarily) Database Systems p. 72/569
13 Examples stud_no name date of birth course_no title credits N M student attends lecture attends(stud_no, course_no) pers_no name office_no course_no title credits professor 1 N gives lecture gives(course_no, pers_no) Database Systems p. 73/569
14 Simplifying the Schema There may be relations with the same key after the second step Relations with the same key are merged into a single relation This happens in the case of 1:N, N:1, and 1:1 multiplicities The relationship relation has the same key as one of the entity relations Database Systems p. 74/569
15 Example lecture andgives have the same key: lecture(course_no, title, credits) gives(course_no, pers_no) lecture(course_no, title, credits, pers_no) Database Systems p. 75/569
16 Example Continued pers no is called a foreign key inlecture It references the key inprofessor (and also contains the same values) Sometimes foreign keys are renamed to make it clear where they come from lecture(course_no, title, credits, prof_pers_no) Database Systems p. 76/569
17 Weak Entities Basically, weak entities are converted like 1:N relationships Major difference: the weak entity has a combined key building no office no 1 N building in office building(building_no,... ) office(building_no, office_no,... ) Database Systems p. 77/569
18 Generalizations Generalizations are converted in three different ways There is no direct equivalent translation into the relational model pers_no name employee is a area assistant professor office no (1) only super-type, (2) only sub-types, (3) all types Database Systems p. 78/569
19 Generalizations(2) Only super-type: employee(pers_no, name, area, office_no) Issue: NULL values Only sub-types: assistant(pers_no, name, area) professor(pers_no, name, office_no) Issue: employees who are neither assistants nor professors All types: employee(pers_no, name) assistant(pers_no, area) professor(pers_no, office_no) Issue: information is distributed among three relations Database Systems p. 79/569
20 Generalizations(3) There is no silver bullet You have to make a decision depending on the requirements of the application Database Systems p. 80/569
21 Query Languages So far we have only looked at how to describe the stored data We haven t covered how to retrieve the data from the database In order to access the data we need a query language The relational model comes with the relational algebra as query language Database Systems p. 81/569
22 Relational Algebra All the operators of the relational algebra are set-oriented and closed: Each operator gets as input one or more sets of tuples and outputs a set of tuples relation relation input... relational algebra operator output relation Let us have a closer look at the operators Database Systems p. 82/569
23 Projection Chooses a subset of attributes (columns) A 1,...,A n from a relation R... and throws away the other attributes: Has the following syntax: π A1,...,A n (R) Database Systems p. 83/569
24 Example student stud_no name date_of_birth Query: Algebra: 1 Smith, John Miller, Anne Jones, Betty Johnson, Boris Output the names of all students π name (student) name Smith, John Miller, Anne Jones, Betty Johnson, Boris Database Systems p. 84/569
25 Projection(2) What happens with duplicates? The (basic) relational model is set-oriented: a relation is a set of tuples That means, duplicates are removed Database Systems p. 85/569
26 Example student stud_no name date_of_birth Query: Algebra: 1 Smith, John Miller, Anne Jones, Betty Johnson, Boris Output the birthdays of all students π date_of_birth (student) date_of_birth Database Systems p. 86/569
27 Selection Chooses a subset of tuples (rows) t 1,...,t n from R... and throws away the other tuples: Has the following syntax: σ p (R) A tuple has to satisfy the predicate p to stay in The usual comparison operators are used in predicates: =,<,,>, Predicates can be combined via,, Database Systems p. 87/569
28 Query: Algebra: Example student stud_no name date_of_birth 1 Smith, John Miller, Anne Jones, Betty Johnson, Boris Get all students with a student number less or equal than 3 and a date of birth after σ stud_no 3 date_of_birth> (student) stud_no name date_of_birth 2 Miller, Anne Jones, Betty Database Systems p. 88/569
29 Cartesian Product Up to now, all operators had one relation as input parameter What do we do if we need information from more than one table? The Cartesian product (or cross product) combines every tuple of one relation with every tuple of another Syntax: R 1 R 2. Database Systems p. 89/569
30 Example lecture course_no... prof_pers_no professor pers_no name... 1 Gamper... 2 Helmer... Query: Algebra: Output all lectures and professors lecture professor Database Systems p. 90/569
31 Result course_no... prof_pers_no pers_no name Gamper Helmer Gamper Helmer Gamper Helmer Gamper Helmer... Database Systems p. 91/569
32 Filtering Out Useless Combinations Many of the tuples on the previous slide merge lectures with professors who have nothing to do with this lecture Useless combinations can be filtered out with a selection For our example, we could rewrite the query to σ prof_pers_no=pers_no (lecture professor) Database Systems p. 92/569
33 Join As cross product/filtering is needed very often, there is a shortcut: a join operator ( ) R 1 R1.A i =R 2.A j R 2 = σ R1.A i =R 2.A j (R 1 R 2 ) Joins can also be implemented more efficiently than Cartesian products Database Systems p. 93/569
34 Example Query: Algebra: Output all lectures together with the responsible professors lecture prof_pers_no=pers_no professor course_no... prof_pers_no pers_no name Gamper Gamper Helmer Helmer... Database Systems p. 94/569
35 Combining Relations The names of attributes in a relation need to be unique Important when combining different relations Example: assistant(pers_no, name, area, mgr) professor(pers_no, name, office_no) assistant mgr=pers_no professor We have two different personnel numbers: one for assistants, another for professors Database Systems p. 95/569
36 Renaming In order to keep names unique, we can do renaming: Chooses a subset of attributes and gives them new names Has the following syntax: ρ B1 A 1,...,B n A n (R) Database Systems p. 96/569
37 Example So to avoid clashes between attribute names, we could rename attributes before joining: In relational algebra: ρ a_no pers_no,a_name name (assistant) mgr=p_pers_no ρ p_pers_no pers_no,p_name name (professor) This helps us in distinguishing which attributes come from which relation Database Systems p. 97/569
38 Joins Revisited There are different variants of joins, classified after the join predicate Theta-join (θ-join): the most general join, the predicate may include arbitrary comparison operators That is the one we have looked at so far Equi-join: the join predicate only checks for equality (subset of θ-joins) Natural join: a special version of an equi-join We will now look at this operator in more detail Database Systems p. 98/569
39 Natural Join A natural join does an equi-join on attributes with the same names and projects away the redundant columns does not have a join predicate (it s implicit) Query: Algebra: Output all lectures together with the responsible professors (ρ pers_no prof_pers_no (lecture)) professor course_no... pers_no name Gamper Gamper Helmer Helmer... Database Systems p. 99/569
40 Joins Revisited(2) You can join an arbitrary number of relations in a single relational algebra expression The order does not matter, you ll always get the same result Join operators are commutative and associative Database Systems p. 100/569
41 Example Combine students with the lectures they attend student stud_no name... 1 Smith... 2 Miller lecture course_no title... 1 databases... 2 networks attends stud_no course_no Database Systems p. 101/569
42 Example(2) So we could join the three relations in any of the following ways: student attends lecture student lecture attends attends student lecture attends lecture student lecture student attends lecture attends student You ll notice that the 2nd and 5th permutation joins two relations that do no have a common attribute In that case, the natural join computes a Cartesian product Database Systems p. 102/569
43 Even More Joins If a tuple does not find a join partner in the other relation, it is dropped If you want to keep these tuples, you need to use an outer join Database Systems p. 103/569
44 Full Outer Join In a full outer join ( ) all tuples from both relations are kept L A B C a 1 b 1 c 1 a 2 b 2 c 2 R C D E c 1 d 1 e 1 c 3 d 2 e 2 = result A B C D E a 1 b 1 c 1 d 1 e 1 a 2 b 2 c 2 c 3 d 2 e 2 A natural join would only return the first tuple Database Systems p. 104/569
45 Left Outer Join In a left outer join this is only true for tuples from the relation on the left-hand side L A B C a 1 b 1 c 1 a 2 b 2 c 2 R result C D E = A B C D E c 1 d 1 e 1 a 1 b 1 c 1 d 1 e 1 c 3 d 2 e 2 a 2 b 2 c 2 Database Systems p. 105/569
46 Right Outer Join In a right outer join this is only true for tuples from the relation on the right-hand side L A B C a 1 b 1 c 1 a 2 b 2 c 2 R result C D E = A B C D E c 1 d 1 e 1 a 1 b 1 c 1 d 1 e 1 c 3 d 2 e 2 c 3 d 2 e 2 Database Systems p. 106/569
47 Semi-Join A semi-join does not really join the relations It checks which of the tuples in the relation on the left-hand side satisfies the join predicate... and then keeps those A L B C a 1 b 1 c 1 a 2 b 2 c 2 C R D E = A result B C c 1 d 1 e 1 c 3 d 2 e 2 a 1 b 1 c 1 Database Systems p. 107/569
48 Semi-Join(2) There is also the right-handed version: A L B C a 1 b 1 c 1 a 2 b 2 c 2 C R D E = C result D E c 1 d 1 e 1 c 3 d 2 e 2 c 1 d 1 e 1 Database Systems p. 108/569
49 Set Operations Set operations such as union, intersection, and difference can also be applied to relations... provided that both relations have the same schema, meaning: same number of attributes (with the same names) corresponding attributes have the same data type Database Systems p. 109/569
50 Union prof1 pers_no name 1 Gamper 2 Helmer prof2 pers_no name 2 Helmer 3 Wood Query: Algebra: Create the union of the relation prof1 and prof2 prof1 prof2 pers_no name 1 Gamper 2 Helmer 3 Wood Database Systems p. 110/569
51 Intersection prof1 pers_no name 1 Gamper 2 Helmer prof2 pers_no name 2 Helmer 3 Wood Query: Algebra: Which professors are in both relations? prof1 prof2 pers_no name 2 Helmer Database Systems p. 111/569
52 Set Difference prof1 pers_no name 1 Gamper 2 Helmer prof2 pers_no name 2 Helmer 3 Wood Query: Algebra: Which professors are in the first but not the second relation? prof1 \ prof2 pers_no name 1 Gamper Database Systems p. 112/569
53 Relational Division Relational division is the most complicated operator found in relational algebra Let s start nice and simple: In arithmetic, division is the opposite of multiplication The Cartesian product can be seen as multiplying two relations So relational division can be interpreted as the opposite of the Cartesian product Database Systems p. 113/569
54 Relational Division(2) Let s look at a concrete example: R A a b c S B 1 2 R S A B a 1 a 2 b 1 b 2 c 1 c 2 Dividing R S by R or S gives us the following results: (R S) R = S (R S) S = R Database Systems p. 114/569
55 Relational Division(3) What happens if we apply relational division T R to an arbitrary relation T? That means, T is not the immediate result of a Cartesian product R X Can t be that arbitrary: R T has to hold Roughly similar to dividing 8 by 3 (integer division) 8 is not divisible by 3, but we can say that 8 3 = 2 remainder 2 When computing T R, we try to find a relation R such that R R covers as much as possible of T Database Systems p. 115/569
56 Relational Division(4) Let s look at a concrete example again: T R A B S A B a 2 (R R ) a (S S) b 1 1 b (S S) b 2 (R R ) 2 c (S S) c 1 (S S) c 2 (R R ) T S = S T R = R S A b c R B 2 Database Systems p. 116/569
57 Relational Division(5) S does not include a, as this would produce [a,1], which is not in T S S creates four tuples and we have the remainder [a,2] R does not include 1, as this would again produce [a,1], which is not in T R R creates three tuples and we have the remainder [b,1], [c,1] We have some leftover tuples not covered by the Cartesian product Database Systems p. 117/569
58 What Do We Need It For? Relational division is used to answer queries involving universal quantification: attends stud_no course_no Query: lect1 course_no 1 2 lect2 course_no 1 3 lect3 course_no List thestud no of all students who attend all lectures inlect1/lect2/lect Database Systems p. 118/569
59 Result attends lect1 stud_no 1 3 attends lect2 stud_no 2 3 attends lect3 stud_no 3 Database Systems p. 119/569
60 Formal Definition There is also a formal definition using other operators: { }} { 1 {}}{ T R = π (T \R) (T)\π (T \R) (( π (T \R) (T) R)\T) }{{} } 2 {{ } 4 1. Take the values in T of attributes not shared with R 2. Combine them with R in a Cartesian product 3. Subtract all the stuff that is in T (Now we are left with what s missing in T from the full Cartesian product) 4. Subtract this from 1. and we are now left with the values participating in a product 3 Database Systems p. 120/569
61 Summary The relational model and its variants are the most common data models used in DBMSs In this chapter we covered the (more theoretical) basics of the model: Definition of the model Transforming an ER diagram into a relational schema A first basic query language Database Systems p. 121/569
Chapter 4 SQL. Database Systems p. 121/567
Chapter 4 SQL Database Systems p. 121/567 General Remarks SQL stands for Structured Query Language Formerly known as SEQUEL: Structured English Query Language Standardized query language for relational
More informationInformationslogistik Unit 4: The Relational Algebra
Informationslogistik Unit 4: The Relational Algebra 26. III. 2012 Outline 1 SQL 2 Summary What happened so far? 3 The Relational Algebra Summary 4 The Relational Calculus Outline 1 SQL 2 Summary What happened
More informationChapter 2. Database Design. Database Systems p. 25/540
Chapter 2 Database Design Database Systems p. 25/540 Database Design Phases requirements analysis specification conceptual design conceptual schema logical design logical schema physical design physical
More informationRelational Model: History
Relational Model: History Objectives of Relational Model: 1. Promote high degree of data independence 2. Eliminate redundancy, consistency, etc. problems 3. Enable proliferation of non-procedural DML s
More informationDatabase Technology Introduction. Heiko Paulheim
Database Technology Introduction Outline The Need for Databases Data Models Relational Databases Database Design Storage Manager Query Processing Transaction Manager Introduction to the Relational Model
More informationRelational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity
COS 597A: Principles of Database and Information Systems Relational model continued Understanding how to use the relational model 1 with as weak entity folded into folded into branches: (br_, librarian,
More informationLecture 16. The Relational Model
Lecture 16 The Relational Model Lecture 16 Today s Lecture 1. The Relational Model & Relational Algebra 2. Relational Algebra Pt. II [Optional: may skip] 2 Lecture 16 > Section 1 1. The Relational Model
More informationCSC 261/461 Database Systems Lecture 13. Fall 2017
CSC 261/461 Database Systems Lecture 13 Fall 2017 Announcement Start learning HTML, CSS, JavaScript, PHP + SQL We will cover the basics next week https://www.w3schools.com/php/php_mysql_intro.asp Project
More information1 Relational Data Model
Prof. Dr.-Ing. Wolfgang Lehner INTELLIGENT DATABASE GROUP 1 Relational Data Model What is in the Lecture? 1. Database Usage Query Programming Design 2 Relational Model 3 The Relational Model The Relation
More informationRelational Model, Relational Algebra, and SQL
Relational Model, Relational Algebra, and SQL August 29, 2007 1 Relational Model Data model. constraints. Set of conceptual tools for describing of data, data semantics, data relationships, and data integrity
More informationIntroduction to Data Management CSE 344. Lectures 8: Relational Algebra
Introduction to Data Management CSE 344 Lectures 8: Relational Algebra CSE 344 - Winter 2016 1 Announcements Homework 3 is posted Microsoft Azure Cloud services! Use the promotion code you received Due
More informationRelational Algebra for sets Introduction to relational algebra for bags
Relational Algebra for sets Introduction to relational algebra for bags Thursday, September 27, 2012 1 1 Terminology for Relational Databases Slide repeated from Lecture 1... Account Number Owner Balance
More informationDatabase Systems. Sven Helmer. Database Systems p. 1/567
Database Systems Sven Helmer Database Systems p. 1/567 Chapter 1 Introduction and Motivation Database Systems p. 2/567 Introduction What is a database system (DBS)? Obviously a system for storing and managing
More informationRelational Model and Relational Algebra
Relational Model and Relational Algebra CMPSCI 445 Database Systems Fall 2008 Some slide content courtesy of Zack Ives, Ramakrishnan & Gehrke, Dan Suciu, Ullman & Widom Next lectures: Querying relational
More informationFaloutsos - Pavlo CMU SCS /615
Faloutsos - Pavlo 15-415/615 Carnegie Mellon Univ. School of Computer Science 15-415/615 - DB Applications C. Faloutsos & A. Pavlo Lecture #4: Relational Algebra Overview history concepts Formal query
More informationRelational Model and Relational Algebra. Rose-Hulman Institute of Technology Curt Clifton
Relational Model and Relational Algebra Rose-Hulman Institute of Technology Curt Clifton Administrative Notes Grading Weights Schedule Updated Review ER Design Techniques Avoid redundancy and don t duplicate
More informationOverview. Carnegie Mellon Univ. School of Computer Science /615 - DB Applications. Concepts - reminder. History
Faloutsos - Pavlo 15-415/615 Carnegie Mellon Univ. School of Computer Science 15-415/615 - DB Applications C. Faloutsos & A. Pavlo Lecture #4: Relational Algebra Overview history concepts Formal query
More informationRelational Algebra and SQL
Relational Algebra and SQL Relational Algebra. This algebra is an important form of query language for the relational model. The operators of the relational algebra: divided into the following classes:
More informationCS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #2: The Relational Model and Relational Algebra
CS 4604: Introduction to Database Management Systems B. Aditya Prakash Lecture #2: The Relational Model and Relational Algebra Course Outline Weeks 1 4: Query/ Manipulation Languages and Data Modeling
More informationIan Kenny. November 28, 2017
Ian Kenny November 28, 2017 Introductory Databases Relational Algebra Introduction In this lecture we will cover Relational Algebra. Relational Algebra is the foundation upon which SQL is built and is
More information4/10/2018. Relational Algebra (RA) 1. Selection (σ) 2. Projection (Π) Note that RA Operators are Compositional! 3.
Lecture 33: The Relational Model 2 Professor Xiannong Meng Spring 2018 Lecture and activity contents are based on what Prof Chris Ré of Stanford used in his CS 145 in the fall 2016 term with permission
More informationIntroduction to Data Management CSE 344. Lectures 8: Relational Algebra
Introduction to Data Management CSE 344 Lectures 8: Relational Algebra CSE 344 - Winter 2017 1 Announcements Homework 3 is posted Microsoft Azure Cloud services! Use the promotion code you received Due
More informationRELATIONAL DATA MODEL: Relational Algebra
RELATIONAL DATA MODEL: Relational Algebra Outline 1. Relational Algebra 2. Relational Algebra Example Queries 1. Relational Algebra A basic set of relational model operations constitute the relational
More informationChapter 2: Intro to Relational Model
Non è possibile visualizzare l'immagine. Chapter 2: Intro to Relational Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Example of a Relation attributes (or columns)
More informationRelational Model 2: Relational Algebra
Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong The relational model defines: 1 the format by which data should be stored; 2 the operations for querying the data.
More informationRelational Algebra. Mr. Prasad Sawant. MACS College. Mr.Prasad Sawant MACS College Pune
Relational Algebra Mr. Prasad Sawant MACS College Pune MACS College Relational Algebra Tuple - a collection of attributes which describe some real world entity. Attribute - a real world role played by
More informationChapter 6 The Relational Algebra and Relational Calculus
Chapter 6 The Relational Algebra and Relational Calculus Fundamentals of Database Systems, 6/e The Relational Algebra and Relational Calculus Dr. Salha M. Alzahrani 1 Fundamentals of Databases Topics so
More informationCMP-3440 Database Systems
CMP-3440 Database Systems Relational DB Languages Relational Algebra, Calculus, SQL Lecture 05 zain 1 Introduction Relational algebra & relational calculus are formal languages associated with the relational
More informationCS530 Database Architecture Models. Database Model. Prof. Ian HORROCKS. Dr. Robert STEVENS. and Design The Relational
02 - The Relational Database Model CS530 Database Architecture Models and Design Prof. Ian HORROCKS Dr. Robert STEVENS In this Section Topics Covered The basics of the relational model in the context of
More informationCopyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and
Chapter 6 The Relational Algebra and Relational Calculus Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 Outline Unary Relational Operations: SELECT and PROJECT Relational
More informationUnit- III (Functional dependencies and Normalization, Relational Data Model and Relational Algebra)
Unit- III (Functional dependencies and Normalization, Relational Data Model and Relational Algebra) Important questions Section A :(2 Marks) 1.What is Functional Dependency? Functional dependency (FD)
More informationCS317 File and Database Systems
CS317 File and Database Systems Lecture 3 Relational Model & Languages Part-1 September 7, 2018 Sam Siewert More Embedded Systems Summer - Analog, Digital, Firmware, Software Reasons to Consider Catch
More informationRelational Algebra. Lecture 4A Kathleen Durant Northeastern University
Relational Algebra Lecture 4A Kathleen Durant Northeastern University 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple,
More information2.2.2.Relational Database concept
Foreign key:- is a field (or collection of fields) in one table that uniquely identifies a row of another table. In simpler words, the foreign key is defined in a second table, but it refers to the primary
More informationRelational Model Introduction
Relational Model Introduction Proposed by Edgar. F. Codd (1923-2003) in the early seventies. [ Turing Award 1981 ] Most of the modern DBMS are relational. Simple and elegant model with a mathematical basis.
More informationCS 377 Database Systems
CS 377 Database Systems Relational Algebra and Calculus Li Xiong Department of Mathematics and Computer Science Emory University 1 ER Diagram of Company Database 2 3 4 5 Relational Algebra and Relational
More informationInformatics 1: Data & Analysis
Informatics 1: Data & Analysis Lecture 5: Relational Algebra Ian Stark School of Informatics The University of Edinburgh Tuesday 31 January 2017 Semester 2 Week 3 https://blog.inf.ed.ac.uk/da17 Tutorial
More informationDatabases 1. Daniel POP
Databases 1 Daniel POP Week 4 Agenda The Relational Model 1. Origins and history 2. Key concepts 3. Relational integrity 4. Relational algebra 5. 12+1 Codd rules for a relational DBMSes 7. SQL implementation
More informationRelational Databases
Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 49 Plan of the course 1 Relational databases 2 Relational database design 3 Conceptual database design 4
More informationMahathma Gandhi University
Mahathma Gandhi University BSc Computer science III Semester BCS 303 OBJECTIVE TYPE QUESTIONS Choose the correct or best alternative in the following: Q.1 In the relational modes, cardinality is termed
More informationBasant Group of Institution
Basant Group of Institution Visual Basic 6.0 Objective Question Q.1 In the relational modes, cardinality is termed as: (A) Number of tuples. (B) Number of attributes. (C) Number of tables. (D) Number of
More informationCIS 330: Applied Database Systems. ER to Relational Relational Algebra
CIS 330: Applied Database Systems ER to Relational Relational Algebra 1 Logical DB Design: ER to Relational Entity sets to tables: ssn name Employees lot CREATE TABLE Employees (ssn CHAR(11), name CHAR(20),
More informationChapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Example of a Relation attributes (or columns) tuples (or rows) 2.2 Attribute Types The
More informationRelational Algebra Part I. CS 377: Database Systems
Relational Algebra Part I CS 377: Database Systems Recap of Last Week ER Model: Design good conceptual models to store information Relational Model: Table representation with structures and constraints
More informationRelational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.
COSC 304 Introduction to Database Systems Relational Model and Algebra Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Relational Model History The relational model was
More informationRelational Database: The Relational Data Model; Operations on Database Relations
Relational Database: The Relational Data Model; Operations on Database Relations Greg Plaxton Theory in Programming Practice, Spring 2005 Department of Computer Science University of Texas at Austin Overview
More informationRelational Query Languages: Relational Algebra. Juliana Freire
Relational Query Languages: Relational Algebra Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs: Simple
More informationDatabases Relational algebra Lectures for mathematics students
Databases Relational algebra Lectures for mathematics students March 5, 2017 Relational algebra Theoretical model for describing the semantics of relational databases, proposed by T. Codd (who authored
More informationRelational Algebra. Procedural language Six basic operators
Relational algebra Relational Algebra Procedural language Six basic operators select: σ project: union: set difference: Cartesian product: x rename: ρ The operators take one or two relations as inputs
More informationDatabase System Concepts
s Slides (fortemente) baseados nos slides oficiais do livro c Silberschatz, Korth and Sudarshan. Chapter 2: Model Departamento de Engenharia Informática Instituto Superior Técnico 1 st Semester 2009/2010
More informationChapter 6 - Part II The Relational Algebra and Calculus
Chapter 6 - Part II The Relational Algebra and Calculus Copyright 2004 Ramez Elmasri and Shamkant Navathe Division operation DIVISION Operation The division operation is applied to two relations R(Z) S(X),
More informationCMPT 354: Database System I. Lecture 5. Relational Algebra
CMPT 354: Database System I Lecture 5. Relational Algebra 1 What have we learned Lec 1. DatabaseHistory Lec 2. Relational Model Lec 3-4. SQL 2 Why Relational Algebra matter? An essential topic to understand
More informationv Conceptual Design: ER model v Logical Design: ER to relational model v Querying and manipulating data
Outline Conceptual Design: ER model Relational Algebra Calculus Yanlei Diao UMass Amherst Logical Design: ER to relational model Querying and manipulating data Practical language: SQL Declarative: say
More informationTHE RELATIONAL DATABASE MODEL
THE RELATIONAL DATABASE MODEL Introduction to relational DB Basic Objects of relational model Properties of relation Representation of ER model to relation Keys Relational Integrity Rules Functional Dependencies
More informationCS34800 Information Systems. The Relational Model Prof. Walid Aref 29 August, 2016
CS34800 Information Systems The Relational Model Prof. Walid Aref 29 August, 2016 1 Chapter: The Relational Model Structure of Relational Databases Relational Algebra Tuple Relational Calculus Domain Relational
More informationDatabases -Normalization I. (GF Royle, N Spadaccini ) Databases - Normalization I 1 / 24
Databases -Normalization I (GF Royle, N Spadaccini 2006-2010) Databases - Normalization I 1 / 24 This lecture This lecture introduces normal forms, decomposition and normalization. We will explore problems
More informationECE 650 Systems Programming & Engineering. Spring 2018
ECE 650 Systems Programming & Engineering Spring 2018 Relational Databases: Tuples, Tables, Schemas, Relational Algebra Tyler Bletsch Duke University Slides are adapted from Brian Rogers (Duke) Overview
More informationChapter 3: Relational Model
Chapter 3: Relational Model Structure of Relational Databases Relational Algebra Tuple Relational Calculus Domain Relational Calculus Extended Relational-Algebra-Operations Modification of the Database
More informationComp 5311 Database Management Systems. 2. Relational Model and Algebra
Comp 5311 Database Management Systems 2. Relational Model and Algebra 1 Basic Concepts of the Relational Model Entities and relationships of the E-R model are stored in tables also called relations (not
More informationData Analysis 3. SET08104 Database Systems. Napier University
Data Analysis 3 SET08104 Database Systems Copyright @ Napier University Mapping ER Models into Relations Overview map 1:1 relationships into relations map 1:m relationships into relations map m:n relationships
More informationData Analysis 3. Chapter 2.3 V3.0. Napier University Dr Gordon Russell
Data Analysis 3 Chapter 2.3 V3.0 Copyright @ Napier University Dr Gordon Russell Mapping ER Models into Relations Overview map 1:1 relationships into relations map 1:m relationships into relations map
More informationWhy Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages
Why Study the Relational Model? The Relational Model Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models E.G., IBM s IMS Recent competitor: object-oriented
More informationRelational Algebra and Calculus
and Calculus Marek Rychly mrychly@strathmore.edu Strathmore University, @ilabafrica & Brno University of Technology, Faculty of Information Technology Advanced Databases and Enterprise Systems 7 September
More informationWeb Science & Technologies University of Koblenz Landau, Germany. Relational Data Model
Web Science & Technologies University of Koblenz Landau, Germany Relational Data Model Overview Relational data model; Tuples and relations; Schemas and instances; Named vs. unnamed perspective; Relational
More informationLecture Notes for 3 rd August Lecture topic : Introduction to Relational Model. Rishi Barua Shubham Tripathi
Lecture Notes for 3 rd August 2011 Lecture topic : Introduction to Relational Model Rishi Barua 09010141 Shubham Tripathi 09010148 Example of a relation. Attribute (Column) ID Name Department Salary (Rs)
More informationCS317 File and Database Systems
CS317 File and Database Systems Lecture 3 Relational Calculus and Algebra Part-2 September 10, 2017 Sam Siewert RDBMS Fundamental Theory http://dilbert.com/strips/comic/2008-05-07/ Relational Algebra and
More informationRelational Model & Algebra. Announcements (Thu. Aug. 27) Relational data model. CPS 116 Introduction to Database Systems
Relational Model & Algebra CPS 116 Introduction to Database Systems Announcements (Thu. Aug. 27) 2 Homework #1 will be assigned next Tuesday Office hours: see also course website Jun: LSRC D327 Tue. 1.5
More informationThe Relational Model and Relational Algebra
The Relational Model and Relational Algebra Background Introduced by Ted Codd of IBM Research in 1970. Concept of mathematical relation as the underlying basis. The standard database model for most transactional
More informationCOSC344 Database Theory and Applications. σ a= c (P) S. Lecture 4 Relational algebra. π A, P X Q. COSC344 Lecture 4 1
COSC344 Database Theory and Applications σ a= c (P) S π A, C (H) P P X Q Lecture 4 Relational algebra COSC344 Lecture 4 1 Overview Last Lecture Relational Model This Lecture ER to Relational mapping Relational
More informationCS2300: File Structures and Introduction to Database Systems
CS2300: File Structures and Introduction to Database Systems Lecture 9: Relational Model & Relational Algebra Doug McGeehan 1 Brief Review Relational model concepts Informal Terms Formal Terms Table Relation
More informationThe Relational Data Model and Relational Database Constraints
CHAPTER 5 The Relational Data Model and Relational Database Constraints Copyright 2017 Ramez Elmasri and Shamkant B. Navathe Slide 1-2 Chapter Outline Relational Model Concepts Relational Model Constraints
More informationRelational Database Systems 1
Relational Database Systems 1 Wolf-Tilo Balke Benjamin Köhncke Institut für Informationssysteme Technische Universität Braunschweig www.ifis.cs.tu-bs.de Overview Motivation Relational Algebra Query Optimization
More informationChapter 3B Objectives. Relational Set Operators. Relational Set Operators. Relational Algebra Operations
Chapter 3B Objectives Relational Set Operators Learn About relational database operators SELECT & DIFFERENCE PROJECT & JOIN UNION PRODUCT INTERSECT DIVIDE The Database Meta Objects the data dictionary
More informationDatabases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until
Databases Relational Model, Algebra and operations How do we model and manipulate complex data structures inside a computer system? Until 1970.. Many different views or ways of doing this Could use tree
More informationSelection and Projection
Tutorial - Relational Algebra CSC343 - Introduction to Databases Fall 008 TA: Lei Jiang CSC343: Intro. to Databases 1 Selection and Projection σ (R) = {s R s satisfies condition c} c --- selection based
More information1. Introduction; Selection, Projection. 2. Cartesian Product, Join. 5. Formal Definitions, A Bit of Theory
Relational Algebra 169 After completing this chapter, you should be able to enumerate and explain the operations of relational algebra (there is a core of 5 relational algebra operators), write relational
More informationAnnouncements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes
Announcements Relational Model & Algebra CPS 216 Advanced Database Systems Lecture notes Notes version (incomplete) available in the morning on the day of lecture Slides version (complete) available after
More informationChapter 3: The Relational Database Model
Chapter 3: The Relational Database Model Student: 1. The practical significance of taking the logical view of a database is that it serves as a reminder of the simple file concept of data storage. 2. You
More informationChapter 6: RELATIONAL DATA MODEL AND RELATIONAL ALGEBRA
Chapter 6: Relational Data Model and Relational Algebra 1 Chapter 6: RELATIONAL DATA MODEL AND RELATIONAL ALGEBRA RELATIONAL MODEL CONCEPTS The relational model represents the database as a collection
More informationFundamentals of Database Systems
Fundamentals of Database Systems Assignment: 1 Due Date: 8th August, 2017 Instructions This question paper contains 15 questions in 5 pages. Q1: The users are allowed to access different parts of data
More informationRelational Model Concepts
Relational Model Relational Model Concepts The relational model of data is based on the concept of a Relation. A relation is a mathematical concept based on the idea of sets. Relational Model The model
More informationJoin (SQL) - Wikipedia, the free encyclopedia
페이지 1 / 7 Sample tables All subsequent explanations on join types in this article make use of the following two tables. The rows in these tables serve to illustrate the effect of different types of joins
More informationRelational Algebra BASIC OPERATIONS DATABASE SYSTEMS AND CONCEPTS, CSCI 3030U, UOIT, COURSE INSTRUCTOR: JAREK SZLICHTA
Relational Algebra BASIC OPERATIONS 1 What is an Algebra Mathematical system consisting of: Operands -- values from which new values can be constructed. Operators -- symbols denoting procedures that construct
More informationMidterm Review. Winter Lecture 13
Midterm Review Winter 2006-2007 Lecture 13 Midterm Overview 3 hours, single sitting Topics: Relational model relations, keys, relational algebra expressions SQL DDL commands CREATE TABLE, CREATE VIEW Specifying
More informationRelational Query Languages. Preliminaries. Formal Relational Query Languages. Example Schema, with table contents. Relational Algebra
Note: Slides are posted on the class website, protected by a password written on the board Reading: see class home page www.cs.umb.edu/cs630. Relational Algebra CS430/630 Lecture 2 Relational Query Languages
More informationChapter 6: Formal Relational Query Languages
Chapter 6: Formal Relational Query Languages Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 6: Formal Relational Query Languages Relational Algebra Tuple Relational
More informationCOMP 244 DATABASE CONCEPTS AND APPLICATIONS
COMP 244 DATABASE CONCEPTS AND APPLICATIONS Relational Algebra And Calculus 1 Relational Algebra A formal query language associated with the relational model. Queries in ALGEBRA are composed using a collection
More informationUnit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations Zvi M. Kedem 1
Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations 2014 Zvi M. Kedem 1 Relational Algebra And SQL SQL is based on relational algebra with many extensions Some necessary
More informationRELATIONAL ALGEBRA. CS121: Relational Databases Fall 2017 Lecture 2
RELATIONAL ALGEBRA CS121: Relational Databases Fall 2017 Lecture 2 Administrivia 2 First assignment will be available today Due next Thursday, October 5, 2:00 AM TAs will be decided soon Should start having
More informationRelational Algebra Homework 0 Due Tonight, 5pm! R & G, Chapter 4 Room Swap for Tuesday Discussion Section Homework 1 will be posted Tomorrow
Relational Algebra R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of
More informationChapter 2: Relational Model
Chapter 2: Relational Model Database System Concepts, 5 th Ed. See www.db-book.com for conditions on re-use Chapter 2: Relational Model Structure of Relational Databases Fundamental Relational-Algebra-Operations
More informationDBMS. Relational Model. Module Title?
Relational Model Why Study the Relational Model? Most widely used model currently. DB2,, MySQL, Oracle, PostgreSQL, SQLServer, Note: some Legacy systems use older models e.g., IBM s IMS Object-oriented
More informationRELATIONAL DATA MODEL
RELATIONAL DATA MODEL EGCO321 DATABASE SYSTEMS KANAT POOLSAWASD DEPARTMENT OF COMPUTER ENGINEERING MAHIDOL UNIVERSITY RELATIONAL DATA STRUCTURE (1) Relation: A relation is a table with columns and rows.
More informationAgenda. Database Systems. Session 5 Main Theme. Relational Algebra, Relational Calculus, and SQL. Dr. Jean-Claude Franchitti
Database Systems Session 5 Main Theme Relational Algebra, Relational Calculus, and SQL Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences
More informationRelational Model and Relational Algebra
UNIT-III Relational Model and Relational Algebra 1) Define the following terms with an example for each. 8 Marks (Jun / July2014) Super key: A set of attributes SK of R such that no two tuples in any valid
More informationAgent 7 which languages? skills?
Agent 7 which languages? skills? select * from languagerel where agent_id = 7 lang_id agent_id 3 7 14 7 19 7 20 7 agent 7 speaks 4 languages select * from skillrel where agent_id = 7 skill_id agent_id
More informationThis lecture. Databases -Normalization I. Repeating Data. Redundancy. This lecture introduces normal forms, decomposition and normalization.
This lecture Databases -Normalization I This lecture introduces normal forms, decomposition and normalization (GF Royle 2006-8, N Spadaccini 2008) Databases - Normalization I 1 / 23 (GF Royle 2006-8, N
More informationRelational Algebra. [R&G] Chapter 4, Part A CS4320 1
Relational Algebra [R&G] Chapter 4, Part A CS4320 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs:
More informationRelational Algebra. Study Chapter Comp 521 Files and Databases Fall
Relational Algebra Study Chapter 4.1-4.2 Comp 521 Files and Databases Fall 2010 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model
More informationRELATION AND RELATIONAL OPERATIONS
Relation: RELATION AND RELATIONAL OPERATIONS A table with a distinct name for each column (attribute). Each attribute A i has associated with it a domain D i of possible values that may appear in that
More information