select ci.city_name, pr.product_name, ROUND(sum(ii.line_total_price), 2) as tot from city ci, customer cu, invoice i, invoice_item ii, product pr where ci.id = cu.city_id and cu.id = i.customer_id and i.id = ii.invoice_id and ii.product_id = pr.idgroup by ci.city_name, pr.product_name order by tot desc, ci.city_name, pr.product_name | |
This blog strives to provide answers to various problem statements in HackeRank.The blog is used only for educational purposes. This blog does not endorse copying answers.
Friday, April 21, 2023
Product Sales Per City in MySQL
Subscribe to:
Post Comments (Atom)
Featured Post
Popular Posts
-
SET NOCOUNT ON; WITH hours_worked as ( SELECT emp_id, CASE WHEN datepart(minute,TIMESTAMP) >= datepart(minute,l...
-
select c.algorithm, q1.tot, q2.tot, q3.tot, q4.tot from coins c join (select sum(volume) as tot,coins.algorithm from transactions left joi...
-
SELECT c.customer_name, ROUND ( SUM (i.total_price), 6 ) FROM customer c INNER JOIN invoice i ON c.id = i.customer_id GROUP BY ...
-
You are updating the username policy on your company's internal networking platform. According to the policy, a username is considered...
-
The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar ...
-
Jack and Daniel are friends. Both of them like letters, especially uppercase ones. They are cutting uppercase letters from newspapers, and...
-
Write a class called MyRegex which will contain a string pattern. You need to write a regular expression and assign it to the pattern such...
-
We use the integers , , and to create the following series: You are given queries in the form of , , and . For each query, pr...
-
import math import os import random import re import sys from collections import defaultdict # # Complete the 'countPairs'...
-
/*Java's System.out.printf function can be used to print formatted output. The purpose of this exercise is to test your understanding o...
No comments:
Post a Comment