| 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
-
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...
-
You are updating the username policy on your company's internal networking platform. According to the policy, a username is considered...
-
SET NOCOUNT ON; WITH hours_worked as ( SELECT emp_id, CASE WHEN datepart(minute,TIMESTAMP) >= datepart(minute,l...
-
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 ...
-
#!/bin/python3 import math import os import random import re import sys # # Complete the 'taskOfPairing' function below. # # The f...
-
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...
-
Jack and Daniel are friends. Both of them like letters, especially uppercase ones. They are cutting uppercase letters from newspapers, and...
-
The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar ...
-
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. Given a string , print ...
-
In computer science, a set is an abstract data type that can store certain values, without any particular order, and no repeated values(Wi...



No comments:
Post a Comment