Provide SQL queries and the result tables for the following (20 marks): 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 arion 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. List the details of any works of art (including the Artist who created the work) that have more than three copies recorded in the database (i.e., a work that is listed in the database three times). SELECT w.WorkID,w.Title,w.Copy,w.Medium,w.Description,w.ArtistID,a.LastName,a.Nationality,a.DateOfBirth, a.DateDeceased FROM dtoohey.work w JOIN dtoohey.ARTIST a ON w.ArtistID=a.ArtistID WHERE w.Copy > 3; List the details of any work of art (including the Artist who created the work) that has a Surrealist style.   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 (e., works of art that have not been sold). List the sales for each customer (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. 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). 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 2019, and one work of art purchased for $500 in 2020, then the sums would be $2500 and $500, for 2019 and 2020 respectively). Calculate the profit made on works of art that have been sold (e., the profit/loss on an individual work of art is the difference between the acquisition price and the sales price). Which artist has had the most works of art sold, and how many of the artist’s works have been sold? Sales of which artist’s works have resulted in the highest average profit (e., the average of the profits made on each sale of works by an artist), and what is that amount? Customer name of any customers who have an interest in ALL artists.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Provide SQL queries and the result tables for the following (20 marks):

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 arion 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.

  1. List the details of any works of art (including the Artist who created the work) that have more than three copies recorded in the database (i.e., a work that is listed in the database three times).

SELECT w.WorkID,w.Title,w.Copy,w.Medium,w.Description,w.ArtistID,a.LastName,a.Nationality,a.DateOfBirth, a.DateDeceased

FROM dtoohey.work w JOIN dtoohey.ARTIST a ON w.ArtistID=a.ArtistID

WHERE w.Copy > 3;

  1. List the details of any work of art (including the Artist who created the work) that has a Surrealist style.

 

  1. 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 (e., works of art that have not been sold).
  2. List the sales for each customer (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.
  3. 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).
  4. 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 2019, and one work of art purchased for $500 in 2020, then the sums would be $2500 and $500, for 2019 and 2020 respectively).
  5. Calculate the profit made on works of art that have been sold (e., the profit/loss on an individual work of art is the difference between the acquisition price and the sales price).
  6. Which artist has had the most works of art sold, and how many of the artist’s works have been sold?
  7. Sales of which artist’s works have resulted in the highest average profit (e., the average of the profits made on each sale of works by an artist), and what is that amount?
  8. Customer name of any customers who have an interest in ALL artists.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY