{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs 440 lecture 2

# cs 440 lecture 2 - CS 440 Database Management Systems...

This preview shows pages 1–5. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 440: Database Management Systems Review of Relational Algebra z How to design a language to query a relational database? – Relational algebra z Procedural, explain how results are obtained – Relational calculus z Declarative, no need to specify the steps Review of Relational Algebra z Queries consist of a collection of operators z Every operator accepts one or two relation instances as input and return a relation instance as output z Combining these operators can form more complex queries Review of Relational Algebra z Basic operators – SELECT ( σ ), PROJECT ( π ), RENAME ( ρ ) – UNION ( ), INTERSECTION ( ) , MINUS (-) – CROSS PRODUCT ( ) – JOIN ( ), DIVISION ( ) z EQUIJOIN, NATURAL JOIN (*) U I × ÷ >< Review of Relational Algebra z Extended – Generalized π to include projection of functions – Aggregate functions and grouping F – Recursive closure operation – OUTER JOIN z LEFT OUTER JOIN ( ) z RIGHT OUTER JOIN ( ) z FULL OUTER JOIN ( ) – OUTER UNION − − − − >< − − >< >< − − Review of Relational Algebra z Selection z Projection ) ( 5 . 3 Students GPA > σ ) ( , , Students GPA SName SID π Review of Relational Algebra z Display the ID, Name, and GPA of students with a GPA > 3.5 Review of Relational Algebra z Display the ID, Name, and GPA of students with a GPA > 3.5 ) ( 5 . 3 , , Students GPA GPA SName SID > σ π Review of Relational Algebra z Union of two sets of relation instances S R ∪ John 12345 Jean 54321 R Mike 12405 Kathy 43109 S Review of Relational Algebra z Union of two sets of relation instances John 12345 Jean 54321 R Mike 12405 Kathy 43109 S Mike 12405 Kathy 43109 John 12345 Jean 54321 S R ∪ S R ∪ Review of Relational Algebra z Union of two sets of relation instances John 12345 Jean 54321 Mike 12405 R Mike 12405 Kathy 43109 S S R ∪ Review of Relational Algebra z Union of two sets of relation instances John 12345 Jean 54321 Mike 12405 R Mike 12405 Kathy 43109 S Mike 12405 Kathy 43109 John 12345 Jean 54321 S R ∪ S R ∪ Review of Relational Algebra z Union of two sets of relation instances John 12345 Jean 54321 R Mike TX Kathy OR S S R ∪ Review of Relational Algebra z Union of two sets of relation instances John 12345 Jean 54321 R Mike TX Kathy OR S Mike 12405 Kathy 43109 John TX Jean OR S R ∪ S R ∪ Review of Relational Algebra z Union of two sets of relation instances John 12345 Jean 54321 R Mike TX Kathy OR S Mike 12405 Kathy 43109 John TX Jean OR S R ∪ Review of Relational Algebra z Union-compatibility – Same number of fields – Same domain for every corresponding field John 12345 Jean 54321 R Mike TX Kathy OR S Mike 12405 Kathy 43109 John TX Jean OR S R ∪ Review of Relational Algebra z Intersection S R ∩ John 12345 Jean 54321 Mike 12405 R Mike 12405 Kathy 43109 S Relational Algebra z Intersection John 12345 Jean 54321 Mike 12405 R Mike 12405 Kathy 43109 S Mike 12405 S R ∩ S R ∩ Relational Algebra z Intersection needs to respect union- compatibility, too....
View Full Document

{[ snackBarMessage ]}

### Page1 / 12

cs 440 lecture 2 - CS 440 Database Management Systems...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online