download report

Transcript cse102day32

The JOIN operation
Algorithm from the text
1. Construct the product table.
2. Select those rows with matching values.
3. Project to eliminate duplicate columns.
Finish the product table
Fill in the natural join table.
Multiple Table Queries in
• How is a multiple table query
represented in SQL?
• Make a query is Design View to generate
sample SQL
– Which role did Morgan Freeman play in the
movie “The Shawshank Redemption”
• Which tables do you need to answer the
Why look at SQL?
• All queries are expressible in SQL
– Not all queries can be expressed in Design
– Representation: just as web pages are all
composed of HTML, queries are composed
of SQL
• To construct dynamic Web pages that
retrieve and write information to a
database we need SQL
Modifying SQL queries
• Change the SQL to find the answer to
each of these questions:
– What role did Tim Robbins play in the same
• Run the query
– What role did Eddie Murphy play in
“Coming to America”?
• Run the query
– Which movies have Dracula as a role?
• Run the query