Assignment 3: Relational Algebra Solution
|
|
- Gerard Crawford
- 6 years ago
- Views:
Transcription
1 Data Modelling and Databases Exercise dates: March 15/March 16, 2018 Ce Zhang, Gustavo Alonso Last update: April 13, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 3: Relational Algebra Solution This assignment will be discussed during the exercise slots indicated above. If you want feedback for your copy, hand it in during the lecture on the Wednesday before (preferably stapled and with your address). You can also annotate your copy with questions you think should be discussed during the exercise session. If you have questions that are not answered by the solution we provide, send them to Claude 1 Library Database Consider the following relational schema: Reader: (ReaderNr, Surname, Firstname, City, Birthdate) Book: (ISBN, Title, Author, NoPages, PubYear, PubName) Publisher: (PubName, PubCity) Category: (CategoryName, BelongsTo) Copy: (ISBN, CopyNumber, Shelf, Position) Loan: (ReaderNr, ISBN, Copy, ReturnDate) BookCategory: (ISBN, CategoryName) Formulate the following queries in relational algebra: 1. Which are the last names of the readers in Zurich? Surname (σ City= Zurich (Reader)) 2. Which books (Author, Title) are from publishers in Zurich, Bern, or New York?
2 Author,Title (Book (σ PubCity= Zurich PubCity= Bern PubCity= NewYork (Publisher))) Alternative (join first, then project): Author,Title (σ PubCity= Zurich PubCity= Bern PubCity= NewYork (Book Publisher)) 3. Which books (Author, Title) has the reader Lemmi Schmöker borrowed? Author,Title (Book Loan (σ Surname= Schmoker Firstname= Lemmi (Reader))) 4. Which books in the category Alps do not belong to the category Switzerland? Do not take into account subcategories! ( ISBN (σ CategoryName= Alps (Book BookCategory))) ( ISBN (σ CategoryName= Switzerland (Book BookCategory))) The following is not correct: ISBN (σ CategoryName= Alps CategoryName Switzerland (Book BookCategory)) The reason is that the selection operator is defined on tuples. It will thus select book, category pairs that are where the category is both equal to Alps and not equal to Switzerland. The input, which is the result of the join, however, may contain several book, category pairs of the same book. In particular, a book that is in both categories, Alps and Switzerland, has two such tuples, out of which the one in the Alps category matches the selection and the other one does not. Such a book would thus be in the result although it should not. 5. Which readers (Surname, Firstname) have borrowed books that were published in their home town? Firstname,Surname (σ City=PubCity(Publisher Book Loan Reader)) 6. Which readers (Surname, Firstname) have borrowed at least a book that has been borrowed also by the reader Lemmi Schmöker (the reader Lemmi Schmöker should not be included in the results)?
3 R1.Firstname,R1.Surname (ρ R1(Reader) ρ L1 (Loan)) R1.ReaderNr<>R2.ReaderNr,L1.ISBN=L2.ISBN (ρ R2 (σ Surname= Schmoker Surname= Lemmi Reader) ρ L2 (Loan)))
4 2 Olympic Games Consider the following relational schema: Runner: (Name, Birthday, Country) Run: (Name, Distance, Time) A runner can run in several runs over different race distances. Thanks to high-speed cameras, two runners cannot have the exact same time in the same run. 1. For every description find a matching relational algebra query. Some descriptions may not have a matching query. Descriptions: 1. All 100m race distance runs in which only runners from Switzerland (CH ) participated. 2. All runs with a distance greater than 100m in which only runners from Switzerland participated. 3. All runs in which only runners from Switzerland participated. 4. All 100m race distance runs in which the runners were not from Switzerland. 5. All runs in which the runners were not from Switzerland. Relational Algebra Queries: 1. Name,Distance,Time ((Runner σ Country<> CH (Runner)) (Run σ Distance<100 (Run))) 2. Name,Distance,Time ((σ Country= CH (Runner) σ Country<> CH (Runner)) σ Distance<>100 (Run σ Distance<100 (Run))) 3. Name,Distance,Time ((σ Country<> CH (Runner) σ Country= CH (Runner)) σ Distance=100 (Run σ Distance>100 (Run))) 4. Name,Distance,Time ((σ Country= CH (Runner) σ Country<> CH (Runner)) σ Distance=100 (Run σ Distance<100 (Run))) 5. Name,Distance,Time (σ Country<> CH (Runner)) σ Distance>100 (Run σ Distance<100 (Run))) Fill in the table below by writing to every description on the left the right query letter on the right. If there is no matching query for a description, put a cross.
5 Description Query Explanation 1 4 Right side of the join: all 100m runs; left side of the join: all swiss runners (the second/inner term of each side has no effect); the joins gives all 100m runs of swiss runners. 2 2 Left side of the join: all swiss runners (subtracting a disjoint set has no effect); right side of the join: all runs strictly longer than 100m; the join gives all runs of swiss runners with distance strictly greater than 100m. 3 1 Left side of the join: all swiss runners; right side of the join: all runs (the union with a subset has no effect); the join gives all runs of swiss runners. 4 3 Left side of the join: all non-swiss runners (subtracting a disjoint subset has no effect); right side of the join: all 100m runs (the inner subtraction has no effect since it does not remove elements selected outside); the join gives all 100m runs of non-swiss runners. 5-5 Right side of the join: all runs strictly longer than 100m (this inner subtraction has no effect since it does not remove elements selected outside); left side of the join: all non-swiss runners; the join gives all runs of non-swiss runners with a distance strictly longer than 100m. This does not correspond to any description. 2. Which of the following relational algebra expressions finds all runners which only participated in 100m race distance runs? Name (σ Distance=100Run) Name (Runner) Name (σ Distance=100Run) Name (Run) Name (σ Distance=100Run) Name (Run) Name (σ Distance<>100Run) Name (Runner) Name (σ Distance<>100Run) Note: The last query differs in that it contains runners that only participated in 100m races and runners that never participated in any race. Be aware that an entry in the Runner table does not need to appear in the Run table, i.e., some people registered as runners but never ran a race. 3. We want to find winners for every distance. A winner has the shortest time for a given distance. Mark all the queries that find the winners. Name,Country,Distance,Time (Runner (Run Run1.Name,Run1.Distance,Run1.Time ( σ Run1.time>Run2.time (ρ Run1 (Run) Name ρ Run2 (Run))))) Name,Country,Distance,Time (Runner (Run Run1.Name,Run1.Distance,Run1.Time ( σ Run1.time>Run2.time (ρ Run1 (Run) Distance ρ Run2 (Run)))))
6 Name,Country,Distance,Time (Runner (Run Run1.Name,Run1.Distance,Run1.Time ( σ Run1.time<Run2.time (ρ Run1 (Run) Name ρ Run2 Run)))) Name,Country,Distance,Time (Runner (Run Run1.Name,Run1.Distance,Run1.Time ( σ Run1.time<Run2.time (ρ Run1 (Run) Distance ρ Run2 (Run)))))
7 3 Result Cardinality Consider the following two relations: A B B C D 1 x x 0 3 R = 2 y 2 z S = y 2 1 y x w a y 2 0 For the following relational algebra expressions, fill out the number of tuples each of them produces using the data given above. Expression R S 25 R S 5 R S 7 R S 6 R A=D S 3 ρ C A (R) S 2 B (R) - B (σ C<3(S)) 2 A (R) ρ A D( D (S)) 2 D (S) S 5 Size of result (number of tuples)
8 4 Join and Division Operators 1. Consider the following two relations: A B 1 1 B C D P = 1 3 Q = For each of the following expressions circle all the tuples that are not in its result set (the tuples contain all four columns: [A, B, C, D]). A. P Q : B. P Q : (a) [ 1, 1, 7, 2 ] (a) [ 3, 1, 7, 2 ] (b) [ 1, 2, 5, 2 ] (c) [ 3, 2, 5, 0 ] not contained (d) [ 3, 1, 4, 0 ] (e) [ 2, 4, 2, 2 ] not contained (b) [ 4, 1, 4, 0 ] not contained (c) [ 2, 4, -, - ] not contained (d) [ 3, 1, 4, 0 ] (e) [ 1, 3, 2, 2 ] 2. Let {(,..., ) A } be the relation with one tuple containing null-values with the schema of A. Which of the following relational algebra expressions represents 1 a left outer join (R S), 2 a right outer join (R S), and 3 a full outer join (R S). 2 (R S) ((S S (R S)) {(,..., ) R S}) 1 (R S) ((R R (R S)) {(,..., ) S R}) 3 (R S) ((R R (R S)) {(,..., ) S R}) ((S S (R S)) {(,..., ) R S}) 3. Which tuples are included in the output of the following relational division? Student Lecture Fred Databases Tom Databases Lecture Lisa Software Engineering Databases Lisa Compiler Design Networking Tom Compiler Design Tom Networking Fred Fred, Lisa Lisa, Fred Tom Lisa Tom, Lisa
9 5 Train Connections Consider the following relational schema: Cities: (Name, State) Stations: (Name, NoPlatforms, CityName, State) Itinerary: (ItNr, Length, StartStation, DestinationStation) Connections: (FromStation, ToStation, ItNr, Departure, Arrival) Suppose that the relation Connections already contains the transitive closure for each given train, e.g., if there is a direct train from Zurich to Geneva with a stop in Bern, then there exists a relation tuple for Zurich Bern, Bern Geneva, and Zurich Geneva. Formulate the following queries in relational algebra: 1. Find all the direct connections from Zurich (any station) to Geneva (any station) (ρ FromName Name ( Name (σ CityName=Zurich(Stations)))) FromName=FromStation Connections ToName=ToStation (ρ ToName Name ( Name (σ CityName=Geneva(Stations)))) 2. Find all the single-transfer connections from Zurich to Locarno. The transfer station can be any of the stations but the connecting trains should run on the same day. (You can use a function DAY() on the attributes Departure and Arrival in order to determine the day.) (ρ FromName Name ( Name (σ CityName=Zurich(Stations)))) FromName=c1.FromStation ρ c1 (Connections) c1.tostation=c2.fromstation c1.arrival<c2.departure DAY(c1.Arrival)=DAY(c2.Departure) c1.itnr<>c2.itnrρ c2 (Connections) ToName=c2.ToStation (ρ ToName Name ( Name (σ CityName=Locarno(Stations)))) 3. Is it possible to find all possible connections between two stations independent on the number of transfers? Relational algebra does not offer infinite recursion. Therefore, we can only find connections up to a specific maximum search depth.
Assignment 2: Relational Model
Data Modelling and Databases Exercise dates: March 8/March 9, 208 Ce Zhang, Gustavo Alonso Last update: March 6, 208 Spring Semester 208 Head TA: Ingo Müller Assignment 2: Relational Model This assignment
More informationAssignment 2: Relational Model Solution
Data Modelling and Databases Exercise dates: March 8/March 9, 208 Ce Zhang, Gustavo Alonso Last update: March 6, 208 Spring Semester 208 Head TA: Ingo Müller Assignment 2: Relational Model Solution This
More informationETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: August 19, Exam. Questions
Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: August 19, 2017 Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Last
More informationAssignment 1: Entity-Relationship Model Solution
Data odelling and Databases Exercise dates: arch /arch 2, 208 Ce Zhang, Gustavo Alonso Last update: arch 08, 208 Spring Semester 208 Head TA: Ingo üller Assignment : Entity-Relationship odel Solution This
More informationAssignment 7: Integrity Constraints
Data Modelling and Databases Exercise dates: April 19, 2018 Ce Zhang, Gustavo Alonso Last update: April 19, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 7: Integrity Constraints This assignment
More informationAssignment 12: Commit Protocols and Replication
Data Modelling and Databases Exercise dates: May 24 / May 25, 2018 Ce Zhang, Gustavo Alonso Last update: June 04, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 12: Commit Protocols and Replication
More informationAssignment 5: SQL II Solution
Data Modelling and Databases Exercise dates: March 29/March 30, 2018 Ce Zhang, Gustavo Alonso Last update: April 12, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 5: SQL II Solution This assignment
More informationAssignment 6: SQL III
Data Modelling and Databases Exercise dates: April 12/April 13, 2018 Ce Zhang, Gustavo Alonso Last update: April 16, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 6: SQL III This assignment
More informationAssignment 6: SQL III Solution
Data Modelling and Databases Exercise dates: April 12/April 13, 2018 Ce Zhang, Gustavo Alonso Last update: April 16, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 6: SQL III Solution This assignment
More informationExam. Question: Total Points: Score:
FS 2016 Data Modelling and Databases Date: June 9, 2016 ETH Zurich Systems Group Prof. Gustavo Alonso Exam Name: Question: 1 2 3 4 5 6 7 8 9 10 11 Total Points: 15 20 15 10 10 15 10 15 10 10 20 150 Score:
More informationExercise 12: Commit Protocols and Replication
Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: May 22, 2017 Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza
More informationData Modelling and Databases Exercise dates: March 22/March 23, 2018 Ce Zhang, Gustavo Alonso Last update: March 26, 2018.
Data Modelling and Databases Exercise dates: March 22/March 23, 2018 Ce Zhang, Gustavo Alonso Last update: March 26, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 4: SQL This assignment will
More informationAssignment 12: Commit Protocols and Replication Solution
Data Modelling and Databases Exercise dates: May 24 / May 25, 2018 Ce Zhang, Gustavo Alonso Last update: June 04, 2018 Spring Semester 2018 Head TA: Ingo Müller Assignment 12: Commit Protocols and Replication
More informationDSE 203 DAY 1: REVIEW OF DBMS CONCEPTS
DSE 203 DAY 1: REVIEW OF DBMS CONCEPTS Data Models A specification that precisely defines The structure of the data The fundamental operations on the data The logical language to specify queries on the
More informationExercise 9: Normal Forms
Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza Last update:
More informationETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March 27/March 31, Exercise 5: SQL II.
Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Last update:
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 informationExercise 11: Transactions
Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza Last update:
More informationData Modelling and Databases Exercise dates: March 20/March 27, 2017 Ce Zhang, Gustavo Alonso Last update: February 17, 2018.
Data Modelling and Databases Exercise dates: March 20/March 27, 2017 Ce Zhang, Gustavo Alonso Last update: February 17, 2018 Spring Semester 2018 Head TA: Ingo Müller Datasets set-up This assignment will
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 informationQUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS
QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS SCHEMA DESIGN & RELATIONAL ALGEBRA A database schema is the skeleton structure that represents the logical view of the entire database Logical design of
More informationExercise 12: Commit Protocols and Replication
Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: May 22, 2017 Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Eliza
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 informationReview of Sets. Review. Philippe B. Laval. Current Semester. Kennesaw State University. Philippe B. Laval (KSU) Sets Current Semester 1 / 16
Review of Sets Review Philippe B. Laval Kennesaw State University Current Semester Philippe B. Laval (KSU) Sets Current Semester 1 / 16 Outline 1 Introduction 2 Definitions, Notations and Examples 3 Special
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 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 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 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 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 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 informationCS145 Final Examination
CS145 Final Examination Spring 2003, Prof. Widom ffl Please read all instructions (including these) carefully. ffl There are 11 problems on the exam, with a varying number of points for each problem and
More informationConceptual Data Models for Database Design
Conceptual Data Models for Database Design Entity Relationship (ER) Model The most popular high-level conceptual data model is the ER model. It is frequently used for the conceptual design of database
More informationRELATIONAL ALGEBRA. CS 564- Fall ACKs: Dan Suciu, Jignesh Patel, AnHai Doan
RELATIONAL ALGEBRA CS 564- Fall 2016 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan RELATIONAL QUERY LANGUAGES allow the manipulation and retrieval of data from a database two types of query languages: Declarative:
More informationDatabase Systems CSE 414
Database Systems CSE 414 Lecture 15-16: Basics of Data Storage and Indexes (Ch. 8.3-4, 14.1-1.7, & skim 14.2-3) 1 Announcements Midterm on Monday, November 6th, in class Allow 1 page of notes (both sides,
More informationL Information Systems for Engineers. Final exam. ETH Zurich, Autumn Semester 2017 Friday
252-0834-00L Information Systems for Engineers Final exam ETH Zurich, Autumn Semester 2017 Friday 09.02.2018 First name: Last name: Legi number: Signature: You can fill out the above fields immediately,
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 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 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 informationThe Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.
Chapter 6: Entity-Relationship Model Our Story So Far: Relational Tables Databases are structured collections of organized data The Relational model is the most common data organization model The Relational
More informationCS 582 Database Management Systems II
Review of SQL Basics SQL overview Several parts Data-definition language (DDL): insert, delete, modify schemas Data-manipulation language (DML): insert, delete, modify tuples Integrity View definition
More informationRelational Model and Relational Algebra A Short Review Class Notes - CS582-01
Relational Model and Relational Algebra A Short Review Class Notes - CS582-01 Tran Cao Son January 12, 2002 0.1 Basics The following definitions are from the book [1] Relational Model. Relations are tables
More informationLecture 11 - Chapter 8 Relational Database Design Part 1
CMSC 461, Database Management Systems Spring 2018 Lecture 11 - Chapter 8 Relational Database Design Part 1 These slides are based on Database System Concepts 6th edition book and are a modified version
More informationTextbook: Chapter 6! CS425 Fall 2013 Boris Glavic! Chapter 3: Formal Relational Query. Relational Algebra! Select Operation Example! Select Operation!
Chapter 3: Formal Relational Query Languages CS425 Fall 2013 Boris Glavic Chapter 3: Formal Relational Query Languages Relational Algebra Tuple Relational Calculus Domain Relational Calculus Textbook:
More information4. SQL - the Relational Database Language Standard 4.3 Data Manipulation Language (DML)
Since in the result relation each group is represented by exactly one tuple, in the select clause only aggregate functions can appear, or attributes that are used for grouping, i.e., that are also used
More informationIn mathematical terms, the relation itself can be expressed simply in terms of the attributes it contains:
The Relational Model The relational data model organises data as 2-dimensional tables or relations. An example of one such relation would be STUDENT shown below. As we have seen in the wine list example,
More informationX. Query Optimization
X. Lecture Topics Representing Plans Using Relational Algebra Transformation Rules Statistics Estimation CS338 1 Overview Generally, there are many possible access plans for processing a given query. The
More informationCourse Outline Faculty of Computing and Information Technology
Course Outline Faculty of Computing and Information Technology Title Code Instructor Name Credit Hours Prerequisite Prerequisite Skill/Knowledge/Understanding Category Course Goals Statement of Course
More informationComputer Science Applications to Cultural Heritage. Relational Databases
Computer Science Applications to Cultural Heritage Relational Databases Filippo Bergamasco (filippo.bergamasco@unive.it) http://www.dais.unive.it/~bergamasco DAIS, Ca Foscari University of Venice Academic
More informationChapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.
Chapter 6: Entity-Relationship Model The Next Step: Designing DB Schema Our Story So Far: Relational Tables Databases are structured collections of organized data The Relational model is the most common
More informationETH Zurich Spring Semester Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March 20/March 27, 2017.
Data Modelling and Databases (DMDB) ETH Zurich Spring Semester 2017 Systems Group Lecturer(s): Gustavo Alonso, Ce Zhang Date: March Assistant(s): Claude Barthels, Eleftherios Sidirourgos, Last update:
More informationExam Datawarehousing INFOH419 July 2013
Exam Datawarehousing INFOH419 July 2013 Lecturer: Toon Calders Student name:... The exam is open book, so all books and notes can be used. The use of a basic calculator is allowed. The use of a laptop
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 informationChapter 3. The Relational Model. Database Systems p. 61/569
Chapter 3 The Relational Model Database Systems p. 61/569 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
More informationChapter 6 Formal Relational Query Languages
CMSC 461, Database Management Systems Spring 2018 Chapter 6 Formal Relational Query Languages These slides are based on Database System Concepts book and slides, 6th edition, and the 2009/2012 CMSC 461
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 informationCS/B.Tech/CSE/New/SEM-6/CS-601/2013 DATABASE MANAGEMENENT SYSTEM. Time Allotted : 3 Hours Full Marks : 70
CS/B.Tech/CSE/New/SEM-6/CS-601/2013 2013 DATABASE MANAGEMENENT SYSTEM Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers
More informationEntity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables
Entity-Relationship Modelling Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables 1 Entity Sets A enterprise can be modeled as a collection of: entities, and
More informationRelational Algebra. Relational Algebra. 7/4/2017 Md. Golam Moazzam, Dept. of CSE, JU
Relational Algebra 1 Structure of Relational Databases A relational database consists of a collection of tables, each of which is assigned a unique name. A row in a table represents a relationship among
More information1 Probability Review. CS 124 Section #8 Hashing, Skip Lists 3/20/17. Expectation (weighted average): the expectation of a random quantity X is:
CS 124 Section #8 Hashing, Skip Lists 3/20/17 1 Probability Review Expectation (weighted average): the expectation of a random quantity X is: x= x P (X = x) For each value x that X can take on, we look
More informationARTICLE RELATIONAL ALGEBRA
ARTICLE ON RELATIONAL ALGEBRA Tips to crack queries in GATE Exams:- In GATE exam you have no need to learn the syntax of different operations. You have to understand only how to execute that operation.
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 informationMidterm Exam #2 (Version A) CS 122A Winter 2017
NAME: SEAT NO.: STUDENT ID: Midterm Exam #2 (Version A) CS 122A Winter 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 50 minutes; be sure
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 informationIntroduction to database design
Introduction to database design First lecture: RG 3.6, 3.7, [4], most of 5 Second lecture: Rest of RG 5 Rasmus Pagh Some figures are taken from the ppt slides from the book Database systems by Kiefer,
More informationLecture 3 SQL. Shuigeng Zhou. September 23, 2008 School of Computer Science Fudan University
Lecture 3 SQL Shuigeng Zhou September 23, 2008 School of Computer Science Fudan University Outline Basic Structure Set Operations Aggregate Functions Null Values Nested Subqueries Derived Relations Views
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 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 informationCS352 Lecture - Relational Calculus; QBE. Objectives: 1. To briefly introduce the tuple and domain relational calculi 2. To briefly introduce QBE.
CS352 Lecture - Relational Calculus; QBE Objectives: 1. To briefly introduce the tuple and domain relational calculi 2. To briefly introduce QBE. 9/12/06 Materials 1. Jason Rozen QBE demo Senior Project
More informationSets 1. The things in a set are called the elements of it. If x is an element of the set S, we say
Sets 1 Where does mathematics start? What are the ideas which come first, in a logical sense, and form the foundation for everything else? Can we get a very small number of basic ideas? Can we reduce it
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 informationUniversity of Toronto. CSC340S - Information Systems Analysis and Design
csc340 Information Systems Analysis and Design page 1/12 University of Toronto Faculty of Arts and Science Department of Computer Science CSC340S - Information Systems Analysis and Design Spring 2002 John
More informationII. Review/Expansion of Definitions - Ask class for definitions
CS352 Lecture - The Entity-Relationship Model last revised July 25, 2008 Objectives: 1. To discuss using an ER model to think about a database at the conceptual design level. 2. To show how to convert
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 informationLecture Query evaluation. Combining operators. Logical query optimization. By Marina Barsky Winter 2016, University of Toronto
Lecture 02.03. Query evaluation Combining operators. Logical query optimization By Marina Barsky Winter 2016, University of Toronto Quick recap: Relational Algebra Operators Core operators: Selection σ
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 informationRelational Algebra 1 / 38
Relational Algebra 1 / 38 Relational Algebra Relational model specifies stuctures and constraints, relational algebra provides retrieval operations Formal foundation for relational model operations 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 informationDatabase Usage (and Construction)
Lecture 7 Database Usage (and Construction) More SQL Queries and Relational Algebra Previously Capacity per campus? name capacity campus HB2 186 Johanneberg HC1 105 Johanneberg HC2 115 Johanneberg Jupiter44
More informationFINAL EXAM REVIEW. CS121: Introduction to Relational Database Systems Fall 2018 Lecture 27
FINAL EXAM REVIEW CS121: Introduction to Relational Database Systems Fall 2018 Lecture 27 Final Exam Overview 2 Unlimited time, multiple sittings Open book, notes, MySQL database, etc. (the usual) Primary
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 2. Unit 3. Unit 4
Course Objectives At the end of the course the student will be able to: 1. Differentiate database systems from traditional file systems by enumerating the features provided by database systems.. 2. Design
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 informationLecture 04: SQL. Wednesday, October 4, 2006
Lecture 04: SQL Wednesday, October 4, 2006 1 Outline The Project Nulls (6.1.6) Outer joins (6.3.8) Database Modifications (6.5) 2 The Project Application: Boutique online music and book store Project:
More informationCS352 Lecture - Introduction to SQL
CS352 Lecture - Introduction to SQL Objectives: last revised September 12, 2002 1. To introduce the SQL language 2. To introduce basic SQL DML operations (select, insert, update, delete, commit, rollback)
More informationAnswer Key for Exam II Computer Science 420 Dr. St. John Lehman College City University of New York 18 April 2002
Answer Key for Exam II Computer Science 420 Dr. St. John Lehman College City University of New York 18 April 2002 1. True or False: (a) T Every set is a bag. (b) T SQL regards relations as bags of tuples,
More information0. Database Systems 1.1 Introduction to DBMS Information is one of the most valuable resources in this information age! How do we effectively and efficiently manage this information? - How does Wal-Mart
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 informationDatabase Management Systems
Sample Questions 1 Write SQL query to create a table for describing a book. The table should have Book Title, Author, Publisher, Year published, and ISBN fields. Your table should have a primary key. For
More informationMIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38
Student Info StudentID: Center: ExamDate: MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: 1356458 Time: 60 min Marks: 38 BC080402322 OPKST 5/28/2010 12:00:00 AM
More information1. Considering functional dependency, one in which removal from some attributes must affect dependency is called
Q.1 Short Questions Marks 1. Considering functional dependency, one in which removal from some attributes must affect dependency is called 01 A. full functional dependency B. partial dependency C. prime
More informationChapter 4: SQL. Basic Structure
Chapter 4: SQL Basic Structure Set Operations Aggregate Functions Null Values Nested Subqueries Derived Relations Views Modification of the Database Joined Relations Data Definition Language Embedded SQL
More informationCSCC43H: Introduction to Databases
CSCC43H: Introduction to Databases Lecture 2 Wael Aboulsaadat Acknowledgment: these slides are partially based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. CSCC43: Introduction
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 informationCSC 261/461 Database Systems Lecture 19
CSC 261/461 Database Systems Lecture 19 Fall 2017 Announcements CIRC: CIRC is down!!! MongoDB and Spark (mini) projects are at stake. L Project 1 Milestone 4 is out Due date: Last date of class We will
More informationChapter 12: Query Processing
Chapter 12: Query Processing Overview Catalog Information for Cost Estimation $ Measures of Query Cost Selection Operation Sorting Join Operation Other Operations Evaluation of Expressions Transformation
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 informationALTERNATE SCHEMA DIAGRAMMING METHODS DECISION SUPPORT SYSTEMS. CS121: Relational Databases Fall 2017 Lecture 22
ALTERNATE SCHEMA DIAGRAMMING METHODS DECISION SUPPORT SYSTEMS CS121: Relational Databases Fall 2017 Lecture 22 E-R Diagramming 2 E-R diagramming techniques used in book are similar to ones used in industry
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 informationCLASS DISCUSSION AND NOTES
CLASS DISCUSSION AND NOTES February/March 2011 Mon Tue Wed Thu Fri 21 22 23 24 25 Chap. 5 Data Modeling with ER Model 28 March 1 2 3 4 Spring Break I. GETTING STARTED COURSE OVERVIEW II. DATABASE DESIGN
More informationLecture 04: SQL. Monday, April 2, 2007
Lecture 04: SQL Monday, April 2, 2007 1 Outline The Project Nulls (6.1.6) Outer joins (6.3.8) Database Modifications (6.5) 2 NULLS in SQL Whenever we don t have a value, we can put a NULL Can mean many
More information