Question

Subtask 10.2.1 Run the following JOIN of two tables which has two restrictions. Examine the output...

Subtask 10.2.1
Run the following JOIN of two tables which has two restrictions. Examine the output
– is this what you expect? Prefix the query with “EXPLAIN EXTENDED” and review
the output.
SQL
EXPLAIN EXTENDED
SELECT * FROM Orders NATURAL JOIN Order_Details WHERE
QuotedPrice > 1000 AND OrderDate BETWEEN '2012-10-01'
AND '2012-10-31';

Examine the query plan output with the help of the column explanations given above.
Describe in your own words how the DBMS is fetching the rows. For each table, does
it look through the data rows or access them through an index? How does this
influence the number of rows examined? According to the output, which table was
accessed first? Why do you think the DBMS decided to access this table first instead
of the other one (both have restrictions)?
If you need to find out which columns are accessed through an index, run
SHOW indexes in Order_Details;
Document your findings and upload them.

Homework Answers

Answer #1

Here we have used NATURAL JOIN which will works only when both table(Orders and Order_Details) has least one common attribute with same name.For example if the both table has order_id has common column then sql first generates the same column once then join the matching attributes where the values of attributes in both the relations are same.
Naturally the sql hits the first table(Orders) which mentioned in query then compare its value with common attributes(highly detect the primay key or foreign key)and composed of comparing order_id from both the two tables.

And so output for given sql doesn't have all the attributes to join with common order_id because there are two where condition which commonly applied in both tables that QuotedPrice should be greater than 1000 and also OrderDate should be between '2012-10-01 and '2012-10-31'.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Lab 5 Queries with Multiple Tables In this lab, we do queries more than one table....
Lab 5 Queries with Multiple Tables In this lab, we do queries more than one table. SQL provides two different techniques for querying data from multiple tables: • The SQL subquery • The SQL join As you will learn, although both work with multiple tables, they are used for slightly different purposes. We used WMCRM database which is what we created in Lab 4. Here is the summary of the database schema (where schema is used in its meaning of...
After reading the following article, how would you summarize it? What conclusions can be made about...
After reading the following article, how would you summarize it? What conclusions can be made about Amazon? Case 12: Amazon.com Inc.: Retailing Giant to High-Tech Player? (Internet Companies) Overview Founded by Jeff Bezos, online giant Amazon.com, Inc. (Amazon), was incorporated in the state of Washington in July 1994, and sold its first book in July 1995. In May 1997, Amazon (AMZN) completed its initial public offering and its common stock was listed on the NASDAQ Global Select Market. Amazon quickly...
Please show me how to apply CVP analysis for this case study. FLY ASH BRICK PROJECT:...
Please show me how to apply CVP analysis for this case study. FLY ASH BRICK PROJECT: FEASIBILITY STUDY USING CVP ANALYSIS S. K. Mitra and Shubhra Hajela wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be transmitted, photocopied, digitized or otherwise reproduced in any...
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation....
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation. case:    W17400 APIGEE: PEOPLE MANAGEMENT PRACTICES AND THE CHALLENGE OF GROWTH Ranjeet Nambudiri, S. Ramnarayan, and Catherine Xavier wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be...