All sales transactions and viewing parties

Assignment Help Basic Computer Science
Reference no: EM13934885

Using the tables provided above, provide SQL statements for the following queries.

a. Display the name of the customer who has purchased the most cars from Archie's Luxury Motors.

b. For each sales agent, display the total number of sales they have made thus far. Order by number of sales decreasing.

c. For each month in 2014, display the total profit (i.e. using the attributes purchasedPrice and agreedPrice) generated from car sales only. Do not consider any discounts.

d. Display the details (i.e. Manufacturer name, model name, type) of the top selling European car model.

e. Display the details of the best junior sales agent (i.e. ID, Name, DOB) who is under the age of 25, in terms of their average negotiation profit (consider the askingPrice and agreedPrice attributes). The agent returned must have at least three sales to their name.

f. What is the most common car colour that junior agents sold in the month of January 2014?

g. Display the total profit to date for Archie's Luxury Motors. Note that you must take into consideration all car sales (ignoring unsold cars as they may be sold at a later date) and viewing party shows, and any VIP discounts that may apply. Do not subtract any commission owed to the senior sales agents. h. Display the average number of sales transactions (i.e. car sales) per month. i. Display the details (i.e. Manufacturer name, model name) of the cars that are in the top five in terms of highest mileage. Sort the result set in descending order. (Please note: Your solution must use a correlated subquery.

The use of OLAP functions (such as RANK, etc.) is not permissible).

j. Display the most popular car model across all sales transactions and viewing parties. 

Task 2 Provide the implementation of the following stored procedures and function. For submission, please include both the PL/SQL code and an execute procedure/SQL statement to demonstrate the functionality. a. Write a stored procedure that displays the contact details of viewing parties who haven't visited the dealership for over six months. For organisations, include the organisation name in the output. For international guests, include their country in the output. b. Write a stored procedure that accepts a particular year as input, and as output displays the number of cars sold grouped by the 3 mileage groups (Low Mileage: <50000km, Medium Mileage: >=50000km & <150000km, High Mileage: >=150000km). Also include the total number of cars sold in the result. c. Write a stored function that uses a senior agent's ID as input and calculates the total commission owed to date for that agent. You also need to show an SQL statement to display the total amount of commission (i.e. the sum) owed to all of the senior agents in the database. (Refer to the case study in Assignment 1 Part 1 for a description of the commission policy). 

Task 3 [20 marks] Provide the implementation of the following triggers. For submission, please include both the PL/SQL code and an insert statement to demonstrate the trigger functionality.

a. A Trigger which automatically stores in a separate table called ‘ExcellentSale' the Sales Agent name, car model and manufacturer name, each time the agreed price of a SalesTransaction is more than 20% of the car's asking price. (Note: You need to create the ‘ExcellentSale' table before implementing this trigger. To create the primary key, use a sequence that starts at 1 and increments by 1).

b. A Trigger that is activated when a new UserAccount is accidentally associated with a non-VIP Customer.

Reference no: EM13934885

Questions Cloud

Should the firm undertake the training program : A company is planning to invest 60,000 in a personnel training program. The 60,000 outlay will be charged off as an expense by the firm this year (year 0). Years 1-10: $10,000 per year. Years 11-20: $22,000 per year. The company has estimated its cos..
Affect a market makers profit : When delta-hedging, which of the following does not affect a market maker’s profit?
Calculate the deltas of the call and put : A stock has a price of $31 and an annual return volatility of 59 percent. The risk-free rate is 3.03 percent. Calculate the call and put option prices with a strike price of $29 and a 90-day expiration.  Calculate the deltas of the call and put
Create a setup program for the project : Place breakpoints in the code at appropriate places for testing.
All sales transactions and viewing parties : Display the details of the best junior sales agent (i.e. ID, Name, DOB) who is under the age of 25, in terms of their average negotiation profit (consider the askingPrice and agreedPrice attributes). The agent returned must have at least three sal..
What is the ethical dilemma for coach yoast : At the Hall of Fame Nominee dinner, Titus tells Coach-Yoast of the plot to remove Coach Boone. Then later Yoast faces the referees throwing the game. What is the ethical dilemma for Coach Yoast? Were there any alternatives Yoast had
Accounting information system-internal control structure : How they can help accounting information systems to be better understood. (explain to a person from non-accounting field). Can use graphics.
How many tritium atoms incorporated in molecule of palmitate : If the acetyl CoA is labeled at the methyl carbon with tritium, and malonyl CoA is unlabeled, how many tritium atoms will be incorporated into each molecule of palmitate formed?
Probability distribution for the future spot rate : LOU Limited is a US firm and expects to receive Singapore $800, 000 in one year. The existing spot rate of the Singapore dollar is US$0. 74. The one-year forward rate of the Singapore dollar is US$0.76. Novena Limited created a probability distributi..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Managing organizational risk

No longer than a decade ago, IT security professionals had to work hard to persuade organizational leaders about the importance of developing effective risk management plans. Nowadays, due to the plethora of cautionary tales that organizations histor..

  Sloping or perfectly elastic or downward sloping

When will long run market supply be upward sloping or perfectly elastic or downward sloping?

  Determine the peak output voltage for the bridge rectifier

Determine the peak output voltage for the bridge rectifier in Figure 1 shown. Assuming the practical model, what PIV rating is required for the diodes. The transformer is specified to have a 12 Vrms secondary voltage for the standard 120 V across ..

  About computer software

Information professionals with adequate skills are required to maintain the business continuity of database services in an organization. Identify and assess at least three professional skills that would be required to be successful database admini..

  Create a responsibility assignment matrix project

Analyze the critical path of your project, and discuss the total float in the project. Next, suggest the primary measures that you would use in order to manage the critical path and reduce the float in the project.

  What is incremental analysis

1. Our lecture states that relevant costs can also be viewed as avoidable costs. What does this mean? This is a very difficult concept, so help your classmates understand it! 2. What is incremental analysis? How is it used by management?

  What are different sources of secondary data information?

What are different sources of secondary data information?

  Current place of employment or an organization

Explain this use in your current place of employment or an organization you are familiar with. Describe concerns with properly controlling this flow, including keeping it safe from unauthorized use.

  Input controls

Explain the function of input controls.Identify four (4) types of input control and explain the function of each.

  Profit do you make on each wafer

If your demand is 50,000 Woods chips per month and 25,000 Markonchips per month, and your facility can fabricate 150 wafers a month, how many wafersshould you make of each chip?

  Suppose you observe that your home pc

Suppose you observe that your home PC is responding very slowly to information requests from the net. And then you further observe that your network gateway shows high levels of network activity

  Customer relationship management (crm) system

All 3 assignments in this unit involve creating and building upon a Customer Relationship  Management (CRM) system for a nation-wide logistics company. In assignment 3 we aim to  link assignments 1 and 2 together in order to add a reb..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd