Question: Using the relational table LINEITEM of the sample database TPCHR, for each one of the queries listed below: i. Find all the discount (l_discount) of

Using the relational table LINEITEM of the sample database TPCHR, for each one of the queries listed below:

  1. i. Find all the discount (l_discount) of all the items that are shipped (l_shipdate) most recently. Hint. Most recently mean the latest shipment date.
  2. ii. Find the total number of items shipped by air (l_shipmode) in 1998 (l_shipdate).
  3. iii. Find the order number (l_orderkey) and item number (l_linenumber) that have the highest discount (l_discount).
  4. iv. Find the total number of items per line status (l_linestatus). List the line status and the total items per line status.
  5. v. Find the order key (l_orderkey), line item number (l_linenumber), line status (l_linestatus), shipment date (l_shipdate) and shipment mode (l_shipmode) of all orders with the order number (l_orderkey) 1795718, 1799046, and 1794626.

  1. b) Find the smallest number of indexes that improve performance of a given collection of SELECT statements of a relational table LINEITEM. The smallest number of indexing means a database system will compute the five queries constructed in (a) using one or more indexes that you have created. you can create an index that can be used to compute more than one queries. Use the explain plan and show plan statements to justify your solutions.

Need help on answer part B.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Network Questions!