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.
Please find the SQL query below.
SELECT c.FirstName, c.LastName, sum(il.UnitPrice * il.Quantity) as InvoiceTotal FROM Customer c JOIN Invoice i ON c.CustomerId = i.CustomerId JOIN InvoiceLine il ON i.InvoiceId = il.InvoiceId GROUP BY i.CustomerId ORDER BY InvoiceTotal DESC LIMIT 10;
The Chinook team would like to throw a promotional Music Festival for their top 10 customers...
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...
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...
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...
The business process we are
interested in is sales(i.e., selling products to customers).
Develop a logical star- or snowflake-schema dimensional model.
orders customers + PK FK orderdetails PK/EK OrderID PK/FK Products UnitPrice Quantity Discount PK OrderID Customer D FK Employeeld Order Date RequiredDate Shipped Date FK ShipVia Freight ShipName ShipAddress ShipCity ShipRegion ShipPostalCode Ship Country CustomerID CompanyName ContactName Contact Title Address City Region PostalCode Country Phone shipppers PK Shipperid CompanyName Phone Fax products PK ProductID + employees PK Employeeld LastName...
Create the following SQL Server queries that access the
Northwind database
Same as problem 3 but, limit the list to all customers who
placed 3 or more orders.
The product id, product name, last date that the product was
ordered for all items in the Grains/Cereals category. (Hint: Use
MAX)
The product ID, product name, and number of distinct customers
who ordered that product in 1996
Thank you.
Categories Customers Employees Order Details Orders Products Shippers 9 CategoryID CategoryName Description...
Customer Product Manufacturer ManufacturerID ManufacturerName Addressi Address2 City State PostalCode Phone Fax Contact URL Sale Saleltem CustomerID FirstName LastName StreetAddress City State PostalCode Country Phone SalelD SaleDate CustomerID Tax Shipping SaleID ProductiD ItemSize Quantity SalePrice ProductID ProductName ManufacturerID Composition ListPrice Gender Category Color Description Employee EmployeelD o FirstName LastName Address City State ZIP Phone ManagerlD SSN EmailAddress HireDate SalaryEmployee EmployeelD o Salary WageEmployee EmployeelD o Wage MaxHours What are the dollar amounts of each Sale (add all SaleItem amounts) for...
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...
Question for SQL in MS SQL Server Management Studio (Please
don't use where clause for Joins use from clause)
Need to Create a Query to display products purchased by
customers in Germany that were not purchased by customers in the
US.
Customers PK Customer D CompanyName Contact Name Contact Title Address City State OrRegion PostalCode Country Phone char(5) varchar(40) varchar(30) varchar(30) varchar(60) varchar(15) varchar(15) varchar(10) varchar(15) varchar(24) varchar(24) Order Details Orders PK OrderID int FK CustomerlD char(5) FK Employeeld int...
Question for SQL in MS SQL Server Management Studio (Please
don't use where clause for Joins use from clause)
Need to Create a Query because Northwind Traders wants to make
sure that all orders are shipped within 10 days. Display any orders
that were not shipped within 10 days. Include the OrderID, the
OrderDate, and the number of days it took before the order was
shipped.
Customers PK Customer D CompanyName Contact Name Contact Title Address City State OrRegion PostalCode...
Question for SQL in MS SQL Server Management Studio (Please
don't use where clause for Joins use from clause)
Need to Create a Query because Northwind Traders has decided to
increase their retail prices. Write a query that shows the product
name, the current price, and the new price. Make sure the new price
is listed to 2 decimal points. Follow below guidelines on new
retail price:
a. If the
category is beverages or dairy products, increase the price by...