List the sales for each customer

Assignment Help Database Management System
Reference no: EM13327466

SQL (DML)

Provide SQL queries and the result tables for the following:

Please ensure that you include the result table as well as your SQL; you can copy and paste this from either your ssh client or SQL Developer.

Each query is worth 2 marks. These tables exist in sphinx and are owned by the user dtoohey. You may, if you wish, create your own copies of the tables under your own account. If you do so, you should ensure that you copy the sample data in dtoohey's tables.

These queries are based on the View Ridge Gallery database you have been using in the Lab sessions. Please see Chapters 6 and 7 of Kroenke for background to the case and table structures.

Marks are allocated not only for correct answers, but also for best practice in the creation of the queries.

a. List the details of any works of art (including the Artist who created the work) that have more than one copy recorded in the database.

b. List the details of any work of art (including the Artist who created the work) that has an Expressionist style.

c. List the details of the works of art (including the Artist who created the work, and the acquisition and asking price details) currently held in the gallery (i.e., works of art that have not been sold).

d. List the sales for each customer (i.e., when a customer purchases a work of art from the Gallery, a transaction line is created. For a purchase, there will be values in the DateSold and SalesPrice columns). The query should include the details of the customer, the transaction and the work of art purchased.

e. List the names of the deceased artists and the number of years of age they were when they died (for example, an artist born in 1950 and deceased in 2001 has an age of 51).

f. The sum of the acquisition price of works of art for each year (for example, if there were two works of art purchased for $1500 and $1000 in 2007, and one work of art purchased for $500 in 2008, then the sums would be $2500 and $500, for 2007 and 2008 respectively).

g. Calculate the profit made on works of art that have been sold (i.e., the profit/loss on an individual work of art is the difference between the acquisition price and the sales price).

h. Which artist has had the most works of art sold, and how many of the artist's works have been sold?

i. Sales of which artist's works have resulted in the highest average profit (i.e., the average of the profits made on each sale of works by an artist), and what is that amount?

j. Customer name of any customers who have an interest in ALL artists.

Reference no: EM13327466

Questions Cloud

How would you change the current design : How would you change the current design and how does your new design address the problems you have identified with the current design.
What is the range of the baseball : A baseball thrown off a pedestrian pathway, 36 m above the Erie Canal, What is the range of the baseball
Provide the sql to amend the original table design : You have been given the following specifications of a simple database for a netball association that keeps record of players, teams and matches.
What is its recoil speed : A .30-06 rifle fires a bullet with a mass of 10 g at a velocity of 800 m/s. If the rifle has a mass of 4 kg, what is its recoil speed
List the sales for each customer : Each query is worth 2 marks. These tables exist in sphinx and are owned by the user dtoohey. You may, if you wish, create your own copies of the tables under your own account. If you do so, you should ensure that you copy the sample data in dtoohe..
Problem on relational algebra : The database used for this question is a very simple one with the following schema: (Primary keys are bold, foreign keys are underlined)
Define relational database design : List the details of any works of art (including the Artist who created the work) that have more than one copy recorded in the database.
What is the volume of the liquid water : A cube of ice, 27 cm on each side, is melted into a measuring cup. What is the volume of the liquid water
Determine what is x at the end of 10 years : The present value of a payment of 60 at the end of 10 years and 40 at the end of 20 years is equal to 40. The present value of a perpetuity with payments of x at the end of each year is also 40.

Reviews

Write a Review

Database Management System Questions & Answers

  Find the decryption function and decipher

Find '(2007), '(2008), and '(b), where b is the integer obtained from the last four digits of your student number.

  List course along with names of students from database table

List the courses (D-code and C-no), along with the names of the students who are currently taking them. List all the courses (D-code and C-no) that John (i.e., S-Name=''John'') got 'A' grade.

  Types of relationships in a design model of a database

There are many kinds of relationships in a design model of a database. Why is it important to classify each of these types in an ERD Model?

  Explain primary problem in credit card records

You have a file which contains credit card records. Each record contains field for the card number, expiration date, and name of card holder. Explain what primary problem you try to solve is.

  What is the key value of the 4th index

What is the key value of the 4th index record on the top level, assuming each index record points to the record with the highest key value in a block of the next level down?

  Create a table for patients with information

Create a table (by your own imagination) which comprises the least 25 patients with next information (columns): Calculate average of Value1 for each Gender.

  Explain relation schema and set of functional dependencies

Consider relation schema r(A,B,C,D,E, F) and a set of functional dependencies {A BCD,BCDE,BD,DA}. Calculate canonical cover for set of functional dependencies (show each step of your derivation with an explanation).

  Determine the cartesian product of sets

Determine the Cartesian product (A X B) of the given pair of sets. A => Set of first letter of names of countries = A = { R, S, T } B => Set of numbers denoting Postal codes = B = { 0001, 1001}.

  Discuss the costs involved in implementing the database

Using the SafeAssign link in Blackboard to submit your report. Download and print out the FULL report and attach to the appendix at the back of your report. Assignments without the full SafeAssign report will NOT be marked.

  Implement a database based on the provided er diagram

Analyse and comprehend a provided ER diagram and Database Schema and implement a database based on the provided ER diagram and Database Schema

  Explain issues to convert relationship for new cardinality

Using example of vehicles and drivers, explain issues to convert relationship for new cardinality including new relationships and attributes for the tables.

  What is recovering database via rollforward

What is Recovering a database via rollforward? What is aim of transaction log? What is contained in transaction log?

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