The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
QUESTION 13 – PERCENTAGE OF CUSTOMERS (10)
The Sales Manager of Chinook is interested to generate a graph depicting the distribution of customers among different countries. Write a single SQL statement to generate a list with 2 columns: Country and % of Customers. The column Country includes all the countries from the Customer table. The column % of Customers displays the percentage of customers rounded to the nearest 2 decimal places in each country, and the column should be suffixed with a % sign. Sort the result of the query by the column % of Customers in descending order.
QUESTION 14 – TRACK DESCRIPTION (10)
Write a single SQL statement to generate a track description for a randomly selected track from the Track table. Each time when the query runs, a similar result should be displayed:
A NOVIDADE is a 324 seconds long track in the album UNPLUGGED of Eric Clapton composed by Gilberto Gil. It is available as a MPEG audio file for $0.99, and it can be found in the following playlists: Music 1, 90’s Music, Music 2, Brazilian Music
Each bolded part of the track description corresponds to specific data collected from various tables in the database. For instance, A NOVIDADE is an upper cased version of the name of the track. 324 is the number of seconds of that track. UNPLUGGED is an upper cased version of the title of the album of that track. Eric Clapton is the name of the artist, and Gilberto Gil is the name of the composer. MPEG audio file is the name of the media type of the track, and 0.99 is the unit price of the track. Finally, the list of playlists (Music, 90’s Music 1, Music, Brazilian Music 2) are the ones that particular track belongs to.
There will be cases when the composer is unknown, and if that happens ‘an unknown composer’ should be used to replace the name of the composer from the track description. The randomization is based on the total number of tracks. That means each track should have almost an equal chance of being called out by this query.