CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #2: The Relational Model and Relational Algebra

Similar documents
CS 5614: (Big) Data Management Systems. B. Aditya Prakash Lecture #2: The Rela0onal Model, and SQL/Rela0onal Algebra

The Relational Model

Faloutsos - Pavlo CMU SCS /615

Overview. Carnegie Mellon Univ. School of Computer Science /615 - DB Applications. Concepts - reminder. History

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #3: SQL and Rela2onal Algebra- - - Part 1

Standard stuff. Class webpage: cs.rhodes.edu/db Textbook: get it somewhere; used is fine. Prerequisite: CS 241 Coursework:

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #4: SQL---Part 2

Relational Model and Relational Algebra

Lecture 16. The Relational Model

CS 377 Database Systems

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

CSC 261/461 Database Systems Lecture 13. Fall 2017

Basic operators: selection, projection, cross product, union, difference,

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

4/10/2018. Relational Algebra (RA) 1. Selection (σ) 2. Projection (Π) Note that RA Operators are Compositional! 3.

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #1: Introduction

Relational Algebra Homework 0 Due Tonight, 5pm! R & G, Chapter 4 Room Swap for Tuesday Discussion Section Homework 1 will be posted Tomorrow

Announcements. Relational Model & Algebra. Example. Relational data model. Example. Schema versus instance. Lecture notes

Chapter 3. The Relational Model. Database Systems p. 61/569

Relational Query Languages: Relational Algebra. Juliana Freire

Relational Algebra. [R&G] Chapter 4, Part A CS4320 1

Relational Algebra for sets Introduction to relational algebra for bags

Relational Algebra Part I. CS 377: Database Systems

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and

Relational Model 2: Relational Algebra

Informatics 1: Data & Analysis

The Relational Model. Week 2

Chapter 6 The Relational Algebra and Relational Calculus

Database Applications (15-415)

Relational Algebra. Study Chapter Comp 521 Files and Databases Fall

MIS Database Systems Relational Algebra

Database Management Systems. Chapter 4. Relational Algebra. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

Carnegie Mellon Univ. Dept. of Computer Science Database Applications. General Overview - rel. model. Overview - detailed - SQL

Introduction to CS 4604

Database Applications (15-415)

Relational Model, Key Constraints

v Conceptual Design: ER model v Logical Design: ER to relational model v Querying and manipulating data

CMP-3440 Database Systems

Relational Algebra. Relational Query Languages

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1

The Relational Model

L22: The Relational Model (continued) CS3200 Database design (sp18 s2) 4/5/2018

Database Systems ( 資料庫系統 )

Relational Model & Algebra. Announcements (Thu. Aug. 27) Relational data model. CPS 116 Introduction to Database Systems

EECS 647: Introduction to Database Systems

SQL Subqueries. T. M. Murali. September 2, T. M. Murali September 2, 2009 CS 4604: SQL Subqueries

CMPT 354: Database System I. Lecture 5. Relational Algebra

ECE 650 Systems Programming & Engineering. Spring 2018

Introduction to Data Management. Lecture #11 (Relational Algebra)

Relational Model: History

Relational Algebra. Lecture 4A Kathleen Durant Northeastern University

2.2.2.Relational Database concept

Relational Query Languages

EECS 647: Introduction to Database Systems

Database Systems. Course Administration

Relational Algebra 1

COMP 244 DATABASE CONCEPTS AND APPLICATIONS

Chapter 6 Formal Relational Query Languages

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

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #7: En-ty/Rela-onal Model---Part 3

Relational Algebra. Mr. Prasad Sawant. MACS College. Mr.Prasad Sawant MACS College Pune

Database Technology Introduction. Heiko Paulheim

DBMS. Relational Model. Module Title?

RELATIONAL ALGEBRA. CS 564- Fall ACKs: Dan Suciu, Jignesh Patel, AnHai Doan

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

CS2300: File Structures and Introduction to Database Systems

Database Applications (15-415)

Informationslogistik Unit 4: The Relational Algebra

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

Relational Algebra 1. Week 4

Relational Query Languages. Preliminaries. Formal Relational Query Languages. Example Schema, with table contents. Relational Algebra

CMPT 354: Database System I. Lecture 2. Relational Model

Relational Algebra 1

Relational Algebra. Chapter 4, Part A. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

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

Relational Model & Algebra. Announcements (Tue. Sep. 3) Relational data model. CompSci 316 Introduction to Database Systems

Database Applications (15-415)

CSCC43H: Introduction to Databases. Lecture 3

Relational Algebra. Relational Query Languages

Introduction to Data Management CSE 344. Lectures 8: Relational Algebra

CS

Set theory is a branch of mathematics that studies sets. Sets are a collection of objects.

CAS CS 460/660 Introduction to Database Systems. Relational Algebra 1.1

RELATIONAL DATA MODEL: Relational Algebra

1 Relational Data Model

The Relational Algebra

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

Relational Query Languages. Relational Algebra. Preliminaries. Formal Relational Query Languages. Relational Algebra: 5 Basic Operations

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

Database Management Systems MIT Introduction By S. Sabraz Nawaz

Announcements. PS 3 is out (see the usual place on the course web) Be sure to read my notes carefully Also read. Take a break around 10:15am

Modern Database Systems CS-E4610

Relational Algebra. Note: Slides are posted on the class website, protected by a password written on the board

Databases - Relational Algebra. (GF Royle, N Spadaccini ) Databases - Relational Algebra 1 / 24

This lecture. Projection. Relational Algebra. Suppose we have a relation

Relational Databases. Relational Databases. Extended Functional view of Information Manager. e.g. Schema & Example instance of student Relation

The Relational Model

Ian Kenny. November 28, 2017

How to translate ER Model to Relational Model

Relational algebra. Iztok Savnik, FAMNIT. IDB, Algebra

Transcription:

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 Relational Algebra Data definition Programming with SQL Entity-Relationship (E/R) approach Specifying Constraints Good E/R design Weeks 5 8: Indexes, Processing and Optimization Storing Hashing/Sorting Query Optimization NoSQL and Hadoop Week 9-10: Relational Design Functional Dependencies Normalization to avoid redundancy Week 11-12: Concurrency Control Transactions Logging and Recovery Week 13 14: Students choice Practice Problems XML Data mining and warehousing 2

Data Model A Data Model is a notation for describing data or information. Structure of data (e.g. arrays, structs) Conceptual model: In databases, structures are at a higher level. Operations on data (Modifications and Queries) Limited Operations: Ease of programmers and efficiency of database. Constraints on data (what the data can be) Examples of data models The Relational Model The Semistructured-Data Model XML and related standards Object-Relational Model 3

The Relational Model Student Course Grade Hermione Grainger Potions A Draco Malfoy Potions B Harry Potter Potions A Ron Weasley Potions C Structure: Table (like an array of structs) Operations: Relational alebgra (selection, projection, conditions, etc) Constraints: E.g., grades can be only {A, B, C, F} 4

The Semi-structured model <CoursesTaken> <Student>Hermione Grainger</Student> <Course>Potions</Course> <Grade>A</Grade> <Student>Draco Malfoy</Student> <Course>Potions</Course> <Grade>B</Grade>... </CoursesTaken> Structure: Trees or graphs, tags define role played by different pieces of data. Operations: Follow paths in the implied tree from one element to another. Constraints: E.g., can express limitations on data types 5

Comparing the two models Flexibility: XML can represent graphs Ease of use: SQL enables programmer to express wishes at high level. 6

The Relational Model Simple: Built around a single concept for modeling data: the relation or table. A relational database is a collection of relations. Each relation is a table with rows and columns. Supports high-level programming language (SQL). Limited but very useful set of operations Has an elegant mathematical design theory. Most current DBMS are relational (Oracle, IBM DB2, MS SQL) 7

Relations A relation is a two-dimensional table: Relation == table. Attribute == column name. Tuple == row (not the header row). Database == collection of relations. A relation has two parts: Schema defines column heads of the table (attributes). Instance contains the data rows (tuples, rows, or records) of the table. Student Course Grade Hermione Grainger Potions A Draco Malfoy Potions B Harry Potter Potions A Ron Weasley Potions C 8

Schema CoursesTaken : Student Course Grade Hermione Grainger Potions A Draco Malfoy Potions B Harry Potter Potions A Ron Weasley Potions C The schema of a relation is the name of the relation followed by a parenthesized list of attributes. CoursesTaken(Student, Course, Grade) A design in a relational model consists of a set of schemas. Such a set of schemas is called a relational database schema. 9

Relations: Equivalent Representations CoursesTaken : Student Course Grade Hermione Grainger Potions A Draco Malfoy Potions B Harry Potter Potions A Ron Weasley Potions C CoursesTaken(Student, Course, Grade) Relation is a set of tuples and not a list of tuples. Order in which we present the tuples does not matter. Very important! The attributes in a schema are also a set (not a list). Schema is the same irrespective of order of attributes. CoursesTaken(Student, Grade, Course) We specify a standard order when we introduce a schema. How many equivalent representations are there for a relation with m attributes and n tuples? m! n! 10

Degree and Cardinality CoursesTaken : Student Course Grade Hermione Grainger Potions A Draco Malfoy Potions B Harry Potter Potions A Ron Weasley Potions C Degree/Arity is the number of fields/attributes in schema (=3 in the table above) Cardinality is the number of tuples in relation (=4 in the table above) 11

Keys of Relations Keys are one form of integrity constraints (IC) No pair of tuples should have identical keys What is the key for CoursesTaken? Student if only one course in the relation Pair (Student, Course) if multiple courses What if student takes same course many times? Student Course Grade Hermione Grainger Potions A Draco Malfoy Potions B Harry Potter Potions A Ron Weasley Potions C 12

Keys of Relations Keys help associate tuples in different relations SID CID Grade 123 15-401 A 111 15-401 B 123 14-501 B... SID Student GPA 123 Hermione Grainger 3.9 111 Draco Malfoy 3.0 234 Harry Potter 3.7 456 Ron Weasley 3.1 13

Example Create a database for managing class enrollments in a single semester. You should keep track of all students (their names, Ids, and addresses) and professors (name, Id, department). Do not record the address of professors but keep track of their ages. Maintain records of courses also. Like what classroom is assigned to a course, what is the current enrollment, and which department offers it. At most one professor teaches each course. Each student evaluates the professor teaching the course. Note that all course offerings in the semester are unique, i.e. course names and numbers do not overlap. A course can have 0 pre-requisites, excluding itself. A student enrolled in a course must have enrolled in all its pre-requisites. Each student receives a grade in each course. The departments are also unique, and can have at most one chairperson (or dept. head). A chairperson is not allowed to head two or more departments. 14

Example Create a database for managing class enrollments in a single semester. You should keep track of all students (their names, Ids, and addresses) and professors (name, Id, department). Do not record the address of professors but keep track of their ages. Maintain records of courses also. Like what classroom is assigned to a course, what is the current enrollment, and which department offers it. At most one professor teaches each course. Each student evaluates the professor teaching the course. Note that all course offerings in the semester are unique, i.e. course names and numbers do not overlap. A course can have 0 pre-requisites, excluding itself. A student enrolled in a course must have enrolled in all its pre-requisites. Each student receives a grade in each course. The departments are also unique, and can have at most one chairperson (or dept. head). A chairperson is not allowed to head two or more departments. 15

Relational Design for the Example Students (PID: string, Name: string, Address: string) Professors (PID: string, Name: string, Office: string, Age: integer, DepartmentName: string) Courses (Number: integer, DeptName: string, CourseName: string, Classroom: string, Enrollment: integer) Teach (ProfessorPID: string, Number: integer, DeptName: string) Take (StudentPID: string, Number: integer, DeptName: string, Grade: string, ProfessorEvaluation: integer) Departments (Name: string, ChairmanPID: string) PreReq (Number: integer, DeptName: string, PreReqNumber: integer, PreReqDeptName: string) 16

Relational Design Example: Keys? Students (PID: string, Name: string, Address: string) Professors (PID: string, Name: string, Office: string, Age: integer, DepartmentName: string) Courses (Number: integer, DeptName: string, CourseName: string, Classroom: string, Enrollment: integer) Teach (ProfessorPID: string, Number: integer, DeptName: string) Take (StudentPID: string, Number: integer, DeptName: string, Grade: string, ProfessorEvaluation: integer) Departments (Name: string, ChairmanPID: string) PreReq (Number: integer, DeptName: string, PreReqNumber: integer, PreReqDeptName: string) 17

Relational Design: Keys? Students (PID: string, Name: string, Address: string) Professors (PID: string, Name: string, Office: string, Age: integer, DepartmentName: string) Courses (Number: integer, DeptName: string, CourseName: string, Classroom: string, Enrollment: integer) Teach (ProfessorPID: string, Number: integer, DeptName: string) Take (StudentPID: string, Number: integer, DeptName: string, Grade: string, ProfessorEvaluation: integer) Departments (Name: string, ChairmanPID: string) PreReq (Number: integer, DeptName: string, PreReqNumber: integer, PreReqDeptName: string) 18

Issues to Consider in the Design Can we merge Courses and Teach since each professor teaches at most one course? Do we need a separate relation to store evaluations? How can we handle pre-requisites that are or s, e.g., you can take CS 4604 if you have taken either CS 3114 or CS 2606? How do we generalize this schema to handle data over more than one semester? What modifications does the schema need if more than one professor can teach a course? 19

Formal query languages How do we collect information? Eg., find ssn s of people in 415 (recall: everything is a set!) One solution: Rel. algebra, ie., set operators Q1: Which ones?? Q2: what is a minimal set of operators? 20

Relational operators... set union U set difference - 21

Example: Q: find all students (part or full time) A: PT-STUDENT union FT-STUDENT FT-STUDENT Ssn Name 129 peters main str 239 lee 5th ave PT-STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave 22

Observations: two tables are union compatible if they have the same attributes ( domains ) Q: how about intersection U 23

Observations: A: redundant: STUDENT intersection STAFF = STUDENT STAFF 24

Observations: A: redundant: STUDENT intersection STAFF = STUDENT STAFF 25

Observations: A: redundant: STUDENT intersection STAFF = STUDENT - (STUDENT - STAFF) STUDENT STAFF 26

Observations: A: redundant: STUDENT intersection STAFF = STUDENT - (STUDENT - STAFF) Double negation: We ll see it again, later 27

Relational operators... set union set difference - U 28

Other operators? eg, find all students on Main street A: selection σ address= ' main str ' ( STUDENT ) STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave 29

Other operators? Notice: selection (and rest of operators) expect tables, and produce tables (-> can be cascaded!!) For selection, in general: σ condition (RELATION ) 30

Selection - examples Find all Smiths on Main St. σ name='smith' address='main st.' (STUDENT ) condition can be any boolean combination of =, >, >=, <>,... 31

Relational operators selection σ condition.. set union R U S set difference R - S (R) 32

Relational operators selection picks rows - how about columns? A: projection - eg.: π ssn (STUDENT ) finds all the ssn - removing duplicates STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave 33

Relational operators Cascading: find ssn of students on main st. π ssn (σ address='main st' (STUDENT )) STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave 34

Relational operators selection projection. set union σ condition π att list R U S set difference R - S (R) (R) 35

Relational operators Are we done yet? Q: Give a query we can not answer yet! 36

Relational operators A: any query across two or more tables, eg., find names of students in 4604 Q: what extra operator do we need?? STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave SSN c-id grade 123 4604 A 234 5614 B 37

Relational operators A: any query across two or more tables, eg., find names of students in 4604 Q: what extra operator do we need?? A: surprisingly, cartesian product is enough! STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave SSN c-id grade 123 4604 A 234 5614 B 38

Cartesian product eg., dog-breeding: MALE x FEMALE gives all possible couples MALE name spike spot FEMALE name lassie shiba x = M.name spike spike spot spot F.name lassie shiba lassie shiba 39

so what? Eg., how do we find names of students taking 4604? 40

Cartesian product A:... σ STUDENT. ssn = TAKES. ssn( STUDENT x TAKES ) Ssn Name Address ssn cid grade 123 smith main str 123 4604 A 234 jones forbes ave 123 4604 A 123 smith main str 234 5614 B 234 jones forbes ave 234 5614 B 41

Cartesian product..σ cid=4604 (σ STUDENT.ssn=TAKES.ssn (STUDENT x TAKES)) Ssn Name Address ssn cid grade 123 smith main str 123 4604 A 234 jones forbes ave 123 4604 A 123 smith main str 234 5614 B 234 jones forbes ave 234 5614 B 42

π name ( σ cid=4604 (σ STUDENT.ssn=TAKES.ssn (STUDENT x TAKES)) ) Ssn Name Address ssn cid grade 123 smith main str 123 4604 A 234 jones forbes ave 123 4604 A 123 smith main str 234 5614 B 234 jones forbes ave 234 5614 B 43

selection projection FUNDAMENTAL Relational operators σ condition π att list cartesian product MALE x FEMALE set union R U S set difference R - S (R) (R) 44

Relational ops Surprisingly, they are enough, to help us answer almost any query we want!! derived/convenience operators: set intersection join (theta join, equi-join, natural join) rename operator division R S ρ ( R) R' 45

Joins Equijoin: R S = σ ( R S) R. a= S. b R. a= S. b 46

Cartesian product A:... σ STUDENT. ssn = TAKES. ssn( STUDENT x TAKES ) Ssn Name Address ssn cid grade 123 smith main str 123 4604 A 234 jones forbes ave 123 4604 A 123 smith main str 234 5614 B 234 jones forbes ave 234 5614 B 47

Joins Equijoin: theta-joins: R S = σ ( R S) R. a= S. b R R. a= S. b θ generalization of equi-join - any condition S θ 48

Joins very popular: natural join: R S like equi-join, but it drops duplicate columns: STUDENT (ssn, name, address) TAKES (ssn, cid, grade) 49

Joins nat. join has 5 attributes STUDENT TAKES Ssn Name Address ssn cid grade 123 smith main str 123 4604 A 234 jones forbes ave 123 4604 A 123 smith main str 234 5614 B 234 jones forbes ave 234 5614 B equi-join: 6 STUDENT STUDENT. ssn= TAKES. ssn TAKES 50

Natural Joins - nit-picking if no attributes in common between R, S: nat. join -> cartesian product 51

Overview - rel. algebra fundamental operators derived operators joins etc rename division examples 52

Q: why? ρ AFTER Rename op. (BEFORE) A: shorthand; self-joins; for example, find the grand-parents of Tom, given PC (parent-id, child-id) 53

Rename op. PC (parent-id, child-id) PC PC PC p-id Mary Peter John c-id Tom Mary Tom PC p-id Mary Peter John c-id Tom Mary Tom 54

Rename op. first, WRONG attempt: PC PC (why? how many columns?) Second WRONG attempt: PC PC. c id= PC. p id PC 55

Rename op. we clearly need two different names for the same table - hence, the rename op. ρ PC ( PC) 1 PC1. c id= PC. p id PC 56

Overview - rel. algebra fundamental operators derived operators joins etc rename division examples 57

Division Rarely used, but powerful. Example: find suspicious suppliers, ie., suppliers that supplied all the parts in A_BOMB 58

Division SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 ABOMB p# p1 p2 = BAD_S s# s1 Example: find suspicious suppliers, ie., suppliers that supplied all the parts in A_BOMB 59

Division Observations: ~reverse of cartesian product It can be derived from the 5 fundamental operators (!!) How? 60

Division Answer: r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] Observation: find good suppliers, and subtract! (double negation) 61

Division Answer: SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] Observation: find good suppliers, and subtract! (double negation) 62

Division Answer: Table r SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 Table s ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] All suppliers All bad parts 63

Division Answer: Table r SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 Table s ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] all possible suspicious shipments 64

Division Answer: Table r SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 Table s ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] all possible suspicious shipments that didn t happen 65

Division Answer: Table r SHIPMENT s# p# s1 p1 s2 p1 s1 p2 s3 p1 s5 p3 Table s ABOMB p# p1 p2 = BAD_S s# s1 r s = π ( R S )( r) π ( R S )[( π ( R S )( r) s) r] all suppliers who missed at least one suspicious shipment, i.e.: good suppliers 66

Overview - rel. algebra fundamental operators derived operators joins etc rename division examples 67

Sample schema find names of students that take 4604 STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave CLASS c-id c-name units 4513 s.e. 2 4512 o.s. 2 TAKES SSN c-id grade 123 4513 A 234 4513 B 68

Examples find names of students that take 4604 69

Examples find names of students that take 4604 π name [σ c id=4604 (STUDENT TAKES)] 70

find course names of smith Sample schema STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave CLASS c-id c-name units 4613 s.e. 2 4612 o.s. 2 TAKES SSN c-id grade 123 4613 A 234 4613 B 71

Examples find course names of smith π c name [ σ name='smith' ( )] STUDENT TAKES CLASS 72

Examples find ssn of overworked students, ie., that take 4612, 4613, 4604 73

Examples find ssn of overworked students, ie., that take 4612, 4613, 4604: almost correct answer: σ c name=4612 (TAKES) σ c name=4613 (TAKES) σ c name=4604 (TAKES) 74

Examples find ssn of overworked students, ie., that take 4612, 4613, 4604 - Correct answer: π ssn [σ c name=4612 (TAKES)] π ssn [σ c name=4613 (TAKES)] π ssn [σ c name=4604 (TAKES)] 75

Examples find ssn of students that work at least as hard as ssn=123, ie., they take all the courses of ssn=123, and maybe more 76

Sample schema STUDENT Ssn Name Address 123 smith main str 234 jones forbes ave CLASS c-id c-name units 4613 s.e. 2 4612 o.s. 2 TAKES SSN c-id grade 123 4613 A 234 4613 B 77

Examples find ssn of students that work at least as hard as ssn=123 (ie., they take all the courses of ssn=123, and maybe more [ π ssn = 123, c id ( TAKES )] π c id[ σ ssn ( TAKES )] 78

Conclusions Relational model: only tables ( relations ) relational algebra: powerful, minimal: 5 operators can handle almost any query! 79