1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
topjm [15]
4 years ago
9

Write a SELECT statement that returns these column names and data from the Products table: product_name The product_name column

list_price The list_price column discount_percent The discount_percent column discount_amount A column that’s calculated from the previous two columns discount_price A column that’s calculated from the previous three columns Round the discount_amount and discount_price columns to 2 decimal places. Sort the result set by the discount_price column in descending sequence. Use the LIMIT clause so the result set contains only the first 5 rows.
Engineering
1 answer:
I am Lyosha [343]4 years ago
5 0

Answer:

 SELECT  

   product_name, list_price, discount_percent,    

   ROUND(list_price * (discount_percent / 100), 2) AS discount_amount,

   ROUND(list_price - (discount_percent / 100 * list_price), 2)  AS discount_price  

FROM

Products

ORDER BY (list_price - (discount_percent / 100 * list_price)) DESC

LIMIT 5;

Explanation:

In the above SELECT statement is used to select columns from Products table.

The columns are  product_name,list_price and discount_percent

Next a column discount_amount is selected which is the calculated from previous two columns that are list_price and discount_percent. The discount amount is basically calculated by multiplying list_price with discount_percent/100 and the resultant column is named as discount_amount using Alias which is used to give a temporary name to set of columns or a table.

Next another column discount_price is obtained from previous three columns that are  list_price , discount_percent and discount_amount as: list_price - (discount_percent / 100 * list_price) This as a whole is given a column name discount_price.

FROM is used to refer to a table from which these columns are to be selected. The table name is Product.

The result set is sorted in descending order by discount_price so ORDER BY is used to order the resultant records and DESC is used to sort these records according to the discount_price in descending order.

LIMIT statement is used to extract the records from Product and limit the number of rows returned as a result based on a limit value which is 5 here.

You might be interested in
According to the place-time model of interaction, when people are in the same place, but at different times, this is an example
STALIN [3.7K]

Answer: Shift work communication.

Explanation:

Shift work communication is a type of communication that exist between shift workers, or people at different time zones.

Shift work consists of a three eight hours shift within 24 hours.

Keeping up with a shift work communication requires planning, time management and commitment. It also requires using various communication channels.

3 0
3 years ago
Explain briefly the power analogy between the fluid ""water"" and the Word of God.
Alex_Xolod [135]
Is this a spiritual type thing or?
3 0
3 years ago
Select the correct answer. Ruby wants to create a cube puzzle game. For that she has to create a cube. Which drafting tool do yo
Alexxx [7]

Answer:

D. a triangle and a T-Square

Explanation:

A T-Square is the best drawing tool to create squares. You would need a squares to create cubes.

3 0
3 years ago
The basic behind equal driving is to
vlabodo [156]

Follow traffic signs , Keep distance between cars , Be patient in traffic.

4 0
4 years ago
A search will start from a visual lead<br> true<br> false
BlackZzzverrR [31]
True

An organized searching process will need to start from the visual lead area. Eye focus and eye movements from the path of travel in an organized pattern describes a visual search process.
4 0
2 years ago
Read 2 more answers
Other questions:
  • A soil sample has a moist unit weight of 117 pcf, a moisture content of 17 percent, and soil particles with a specific gravity o
    11·1 answer
  • What is civil engineering​
    13·1 answer
  • Which of the following is an early practice of sustainable farming?
    13·1 answer
  • Derive the dimensions of specific heat that is defined as the amount of heat required to elevate the temperature of an object of
    6·1 answer
  • Given the strings s1 and s2, not necessarily of the same length, create a new string consisting of alternating characters of s1
    5·1 answer
  • A 9-m length of 6-mm-diameter steel wire is to be used in a hanger. The wire stretches 18mm when a tensile force P is applied. I
    9·1 answer
  • Which of the following explains the purpose of a convertible screwdriver?
    9·1 answer
  • Which of the following is the BEST definition for e-commerce? *
    13·1 answer
  • Nbel2, i dont know where you've been all this time but i hope you arent missing please respond i haves heard from you since may
    8·2 answers
  • The on-board computer controls the suspension system based on inputs from?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!