Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using analytic functions (also known as windowing functions), display the highest and the lowest carsaleprice for each car make in SI database and show them

  1. Using analytic functions (also known as windowing functions), display the highest and the lowest carsaleprice for each car make in SI database and show them in descending order based on the highest price. 
  2. Using analytic functions return the name of only the customer who bought the fourth most expensive car. 
  3. For each customer from London, return the price of the car they bought and the difference between that price and the average price of the cars sold in that city. 
  4. Options table is frequently used in queries that require optiondes as part of the condition. For example:
    SELECT * FROM options WHERE optiondesc LIKE 'SROOFS';
    Create an index that will improve the performance of this query. You can copy the table and the data from si options table to test your code. Submit (a) the code used for copying the table and the data, (b) the code for creating the index, and (c) the query performance with and (d) without index as well as (e) the results of your code execution and testing. You will have to use command line statements for explaining the plan and displaying it to be able to print the results on the console for copying. 
  5. Place all the SQL code that would perform the above written steps (in 4) in one single file and run it as a single transaction.
    Submit the results of the whole transaction.
    The transaction output must do the following.
  • Remove the table (this step will allow you to run your transaction multiple times without errors. Comment it out when you run the transaction the first time)
  • Create the table and copy the data from si options
  • Explain plan command for the query shown in the previous question.
  • Display the plan
  • Create index for optiondesc column
  • Explain plan command for the query shown in the previous question.
  • Display the plan

Step by Step Solution

3.38 Rating (154 Votes )

There are 3 Steps involved in it

Step: 1

I can certainly guide you through the process and provide examples of SQL queries However keep in mi... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Management Accounting Information for Decision-Making and Strategy Execution

Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young

6th Edition

137024975, 978-0137024971

More Books

Students also viewed these Databases questions

Question

Express the given quantity in terms of sin x and cos x. sin 2 X

Answered: 1 week ago

Question

Briefly explain each of the four steps of the plandocheckact cycle.

Answered: 1 week ago