How to get the MAX and AVG in Oracle? [closed]


As I can get the maximum and the average of 2 columns the fields are:

name, price, quantity.

I want to get the maximum and the next one by category

asked by Juan Perez 08.11.2018 в 19:01

1 answer


With this query it will work for you

SELECT MAX(campo_tabla) AS maximo, AVG(campo_tabla) FROM nombre_tabla WHERE nombre = 'nombre_variable'

Where a SELECT is made with the fields you need, MAX makes the search the maximum record found in your table, AVG takes the average WHERE nombre = 'nombre_variable' if you need the maximum for each < strong> name WHERE nombre = 'nombre_variable' you can do it with where


answered by 08.11.2018 / 19:12