Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

plz reply asap plz plz Product sales You are given a table named product _ sales that contains information about the sales of various products

plz reply asap plz plz
Product sales
You are given a table named product_sales that contains information about the sales of various products in a store.
Task
Retrieve the product details of the top 3 best-selling products. If the products tie in the number of units sold, break the tie by alphabetical order of the product names.
Table description
Input format
Table: product_sales
\table[[Name,Type,Description],[product_id,Int,Represents the unique product identifier],[product_name,Varchar,Represents the name of the product],[units_sold,Int,Represents the number of units sold]]
Output format
\table[[Name,Type,Description],[product_id,Int,Represents the unique product identifier],[product_name,Varchar,Represents the name of the product],[units_sold,Int,Represents the number of units sold]]
Example
Input table
Table: product_sales
\table[[product_id,product_name,units_sold],[1,Laptop,50],[2,Smartphone,75],[3,Headphones,30],[4,Tablet,60],[5,Desktop,45]]
Output table
\table[[product_id,product_name,units_sold],[2,Smartphone,75],[4,Tablet,60],[1,Laptop,50]]
Note:
Your SQL query must be able to print the sample output from the provided sample input. However, the quer run against multiple hidden test cases. Therefore, your query must pass these hidden test cases to solve the problem statement.
Limits
Time Limit: 5sec(s) for each input file
Memory Limit: 256 MB
Source Limit: 1024 KB
Scoring
Score is assigned if any testcase passes
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions