Answered step by step
Verified Expert Solution
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
- 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.
- Using analytic functions return the name of only the customer who bought the fourth most expensive car.
- 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.
- 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. - 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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started