From invoice



Yüklə 23,5 Kb.
tarix23.12.2022
ölçüsü23,5 Kb.
#97765
Taxlil 1 lab


test1
Q1

The Chinook database contains all invoices from the beginning of 2009 till the end of 2013. The employees at Chinook store are interested in seeing all invoices that happened in 2013 only. Using the Invoice table, write a query that returns all the info of the invoices in 2013.


SL1:
SELECT *
FROM Invoice
WHERE InvoiceDate like '2013%'

Q2


The Chinook team decided to run a marketing campaign in Brazil, Canada, india, and Sweden. They will start with the country that has the least customers. Using the customer table, write a query that returns the first name, last name, and country for all customers from the 4 countries
SL2!
SELECT FirstName, LastName, Country
FROM Customer
WHERE ((Country='Brazil')OR(Country='Canada')OR(Country='India')OR(Country='Sweden'))

Q3


Using the Track and Album tables, write a query that returns all the songs that start with the letter 'A' and the composer field is not empty. Your query should return the name of the song, the name of the composer, and the title of the album.
SL3:
SELECT t.Name,t.Composer,a.Title
FROM Album as a
JOIN Track as t
ON t.AlbumId=a.AlbumId
WHERE t.Name LIKE 'A%' AND t.Composer IS NOT NULL ;

Q4
The Chinook team would like to throw a promotional Music Festival for their top 10 cutomers 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.


SL4:
SELECT c.FirstName ,c.LastName, i.Total
FROM Customer c
JOIN Invoice i
ON c.customerid = i.customerid
ORDER BY i.Total DESC LIMIT 10 ;
Yüklə 23,5 Kb.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə