Question

Write an SQL query against the Chinook Database v1.4. Each query must run successfully using DB Browser for SQLite. Create the exact query below. Must use sub query. I saw that a similar solution for this question used IF and CONCAT functions which do not work and return errors. If it is possible to use the CASE function in place of IF that would be greatly appreciated. Also I really hate to ask but if it could be organized neatly that would also be greatly appreciated. Thanks!!

3. Problem 3 (20 points). There is a single track with odd pricing: it is either an audio track whose price is not $0.99 or

Artist Artistid Name Album Albumid Title Artistid MediaType MediaTypeld Name Track Trackld Name Albumid MediaTypeld Genreld C

0 0
Add a comment Improve this question Transcribed image text
Answer #1

select album.title, artist.name, track.name, mediaType.name, concat("$",invoiceLine.unitPrice) from

album, artist, track, mediaType, invoiceLine where

album.artistId=artist.artistId and album.albumId=track.albumId and track.mediatypeId=mediaType.mediaTypeId and track.trackId=invoiceLine.trackId ' and

(mediaType.name like '%audio%' and invoiceLine.unitPrice!=0.99) OR

(mediaType.name like '%video%' and invoiceLine.unitPrice!=1.99)

orderBy track.trackId

Add a comment
Know the answer?
Add Answer to:
Write an SQL query against the Chinook Database v1.4. Each query must run successfully using DB...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The Chinook team would like to throw a promotional Music Festival for their top 10 customers...

    The Chinook team would like to throw a promotional Music Festival for their top 10 customers who have spent the most in a single invoice. Write a query that returns the first name, last name, and invoice total for the top 10 invoices ordered by invoice total descending. MediaType Artist Album Track Artistld Albumld MediaTypeld Trackld Title Name Name Name Artistld Albumld MediaTypeld Genreld Composer Genre Playlist Track Playlist Milliseconds Genreld Playlistld Playlistld Name Bytes Name Trackld UnitPrice InvoiceLine Employee...

  • Hi i need Help. i use MYSQL command line. THE QUESTION ARE BELOW please check the...

    Hi i need Help. i use MYSQL command line. THE QUESTION ARE BELOW please check the answer before you submit because sometimes query gives error thank you For Full database of SQL you can DOWNLOAD from this link: https://drive.google.com/file/d/1xh1TcBfMtvKoxvJr7Csgnts68fF53Q1t/view?usp=sharing ------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- What are the total sales for each year. Note that you will need to use the YEAR function. Order by year with the newest year first. ------------------------------------------------------- How many employees have no customers? ------------------------------------------------------------------ List the total sales for...

  • Using the database: Write SQL queries for each of the questions below. 1. Find the media...

    Using the database: Write SQL queries for each of the questions below. 1. Find the media type which has 100 or more tracks. Print the name of such media type. Number of rows returned in the result = 3 A) Find the playlists which have one or more tracks that have never been purchased in California (CA). Print the Id, and the name of such playlists. Number of rows returned in the result = 18 B) Find the customers who...

  • Based on the CREATE TABLE statements, make an ER model of the database. Give suitable names...

    Based on the CREATE TABLE statements, make an ER model of the database. Give suitable names to the relationships. (Remember cardinality and participation constraints.) The diagram must use either the notation used in the textbook (and the lectures) or the crow’s foot notation. To save you some time: There are a few tables that include the following address fields: Address, City, State, Country and PostalCode (and the same fields with the prefix Billing-). You are allowed to replace these attributes...

  • can someone solve these quick please and thank you! sql chapter 4 Query #1: List the...

    can someone solve these quick please and thank you! sql chapter 4 Query #1: List the company name, contact name, contact title and the phone number for customers who HAVE NOT put in an order. Use an outer join. Query #2: Create a listing displaying the employee first name, last name and the full name (First name space Last Name) of the person they report to (Supervisor). This is a self-join. If an employee does not report to anyone then...

  • Questions are based on the Northwind database. a. A data dictionary (Excel file) that describes each...

    Questions are based on the Northwind database. a. A data dictionary (Excel file) that describes each of the tables. (Attached in question) b.    Write good, clean SQL that answers the following questions. c.     Separate your queries as I have done in the following example. End each query with a semicolon (;) and insert the word "go" between each query. Queries can span multiple lines if required. Select CustomerID from Customers; go Select Count(*) from Employees; go Select max(productID) from Products; 18. Produce...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT