# Write a query to display the largest average product price of any brand (Figure P7.45). FIGURE P7.45 LARGEST AVERAGE BRAND PRICE

### Database Systems: Design, Implemen...

13th Edition
Carlos Coronel + 1 other
Publisher: Cengage Learning
ISBN: 9781337627900

Chapter
Section

### Database Systems: Design, Implemen...

13th Edition
Carlos Coronel + 1 other
Publisher: Cengage Learning
ISBN: 9781337627900
Chapter 7, Problem 45P
Textbook Problem
912 views

## Write a query to display the largest average product price of any brand (Figure P7.45).FIGURE P7.45 LARGEST AVERAGE BRAND PRICE

Program Plan Intro

“GROUP BY” Clause:

The GROUP BY clause is used to group the result of a SELECT statement done on a table where the tuple values are similar for more than one column.

Syntax:

SELECT expression1, expression2, expression_n, aggregate_function (expression)FROM table_name WHERE conditions GROUP BY expression1, expression2, expression_n;

Aggregate Functions:

SQL has some built-in functions and they are called as aggregate functions. SQL contains five built-in functions. They are:

• SUM – This function is used to add values from the particular column.
• Syntax: SELECT SUM(column_Name) FROM table_Name;
• COUNT – This is used to count the number of rows for the particular column.
• Syntax: SELECT COUNT(column_Name) FROM table_Name;
• MAX – This function is used to get the maximum value from the column.
• Syntax: SELECT MAX(column_Name) FROM table_Name;
• MIN – This function is used to get the minimum value from the column.
• Syntax: SELECT MIN(column_Name) FROM table_Name;
• AVG – This function is used to get the average of all the values from the column.
• Syntax: SELECT AVG(column_Name) FROM table_Name;

“Round()” function:

The function used to round a number that specified in decimal places. The format of the “Round()” function is as follows:

Syntax:

ROUND(number, decimal_places)

### Explanation of Solution

SQL code:

The SQL code is to display the largest average product price of any brand from “product” table:

SELECT Max(AVGPRICE) AS [LARGEST AVERAGE]

FROM (SELECT BRAND_ID, Round(Avg(PROD_PRICE),2) AS AVGPRICE

FROM LGPRODUCT P

GROUP BY BRAND_ID);

Ex...

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started

Find more solutions based on key concepts
What type of square has a blade that can be tilted to angular settings?

Precision Machining Technology (MindTap Course List)

List five sports-related products that you think should be designed to make playing sports more fun.

Engineering Fundamentals: An Introduction to Engineering (MindTap Course List)

If your motherboard supports ECC DDR3 memory, can you substitute non-ECC DDR3 memory?

A+ Guide to Hardware (Standalone Book) (MindTap Course List)

Identify issues surrounding accessing an unsecured network.

Enhanced Discovering Computers 2017 (Shelly Cashman Series) (MindTap Course List)

State the advantages of having two oxygen regulators on a machine cutting torch.

Welding: Principles and Applications (MindTap Course List)