Question

Write the sql statement that returns a list of store's cities and countries. Where are they...

  1. Write the sql statement that returns a list of store's cities and countries. Where are they located (city and country)? Show your results.
  2. Write the sql statement that returns the total revenue for those stores. Show your results including store number, city and country.
  3. Write the sql statement that returns the total revenue per year for those stores. Show your results including store number, city and country.
  4. Write the sql statement that returns the average revenue per month regardless of store.Show your results by month number.
  5. Write the sql statement that returns the revenue for the day of the week for those stores, regardless of year or month. Show your results including store number, city and country. Start the list on Sunday.

https://dev.mysql.com/doc/sakila/en/sakila-installation.html

DO NUMBER 3 -- all of the questions are required to know to do this in full context

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

Please find the SQL query below.

Q) Write the sql statement that returns the total revenue per year for those stores. Show your results including store number, city and country.

Query:

SELECT s.store_id, sum(p.payment), c.city, co.country from country co, city c, address a, store s, inventory i, rental r, payment p where s.store_id = i.store_id and i.inventory_id = r.inventory_id and r.rental_i = p.rental_id and s.address_id = a.address_id and a.city_id = c.city_id and c.country_id = co.country_id group by year(p.payment_date), s.store_id;

Add a comment
Know the answer?
Add Answer to:
Write the sql statement that returns a list of store's cities and countries. Where are they...
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
  • Write the sql statement that returns a list of store's cities and countries. Where are they locat...

    Write the sql statement that returns a list of store's cities and countries. Where are they located (city and country)? Show your results. Write the sql statement that returns the total revenue for those stores. Show your results including store number, city and country. Write the sql statement that returns the total revenue per year for those stores. Show your results including store number, city and country. Write the sql statement that returns the average revenue per month regardless of...

  • 1.If you do not have the world schema you can obtain the scripts to create the...

    1.If you do not have the world schema you can obtain the scripts to create the database schema from https://dev.mysql.com/doc/index-other.html Queries 1. Write a SQL subquery that shows the unique region names where the languages spoken are English, French or German. 2. Write a SQL query that shows the country name, region, language for the Caribbean region 3. Write a SQL query that shows the country name once and shows the number of cities in that country. The number of...

  • Write a sql query that returns Which states have more than one customer? List the states and the ...

    write a sql query that returns Which states have more than one customer? List the states and the number of customers for those states. The list must not include the states that do not have more than one customer. CUSTOMER_T CustomerName, Street, City, State, Zip,

  • The Traveling Salesman problem (TSP) is famous. Given a list of cities and the distances in betwe...

    The Traveling Salesman problem (TSP) is famous. Given a list of cities and the distances in between them, the task is to find the shortest possible tour that starts at a city, visits each city exactly once and returns to a starting city. A particular tour can be described as list of all cities [c1,c2, c3, ,cn] ordered by the position in which they are visited with the assumption that you return from the last city to the start. This...

  • Which SQL statement retrieves the EmployeeName and City columns from the Employees table? O LIST EmployeeName,...

    Which SQL statement retrieves the EmployeeName and City columns from the Employees table? O LIST EmployeeName, City ON Employees; O FIND EmployeeName, City ON Employees; SELECT EmployeeName, City FROM Employees; O RETRIEVE EmployeeName, City FROM Employees; Which SQL statement finds the different cities in which national parks reside with no duplicate rows listed? SELECT DISTINCT city FROM natlpark ORDER BY city; O ORDER BY natlpark DISTINCT city; O ORDER BY city FROM natlpark; O SELECT city FROM natlpark ORDER BY...

  • SQL: Write a query to, by store (number), list the maximum number of store visits made...

    SQL: Write a query to, by store (number), list the maximum number of store visits made by a customer. Date_Dimension Date_Key Date Description Day OF Week Day Description Weekday Flag Day OF Month Day OF_Year Month _Descrip... Month Of Year Quarter Descr... v Time_Dimensi... Item_Dimension (dbo. Time_Key ?Item_Key Time Description AM PM Item Number Category_Number Sub_Category_Number Primary_Description Secondary_Description Color Description Size_Description Item Status Code Fineline Item_Scan_ Fact (dbo.Item... Visit Number Store_Key Item Key Member_Key Transaction_Type Key Transaction_Date Key Transaction Store...

  • Using the following tables write a sql command: List the full name and the total number...

    Using the following tables write a sql command: List the full name and the total number of transactions handled by the full time employee. Rank your results in descending order on the total number of transactions. Table: MEMBERS Column Data Type Length Precision Scale Nullable MEMBERID NUMBER 4 0 No MFIRST VARCHAR2 25 No MLAST VARCHAR2 25 No STREET VARCHAR2 64 No CITY VARCHAR2 25 . No STATE VARCHAR2 2 . No ZIPCODE NUMBER 0 No CREDITLIMIT NUMBER 7 2...

  • SQL Queries – in this assignment you will be asked to create several SQL queries relating...

    SQL Queries – in this assignment you will be asked to create several SQL queries relating to the Sakila database that we installed in class. You may freely use DBeaver to create these queries, but I will expect your solution to show me the SQL code to answer or complete the tasks below. Write a query that produces the last name, first name, address, district, and phone number for every customer in the customer table. (You don’t need to include...

  • #6 Write a SELECT statement that returns these columns: The count of the number of orders...

    #6 Write a SELECT statement that returns these columns: The count of the number of orders in the Orders table The sum of the tax_amount columns in the Orders table Write a SELECT statement that returns one row for each category that has products with these columns: The category_name column from the Categories table The count of the products in the Products table The list price of the most expensive product in the Products table Sort the result set so...

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

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