0

enter image description here

Data in Mark table:

Value  Subject_ID  Student_ID
------ ----------- ------------
  91        1         1
  90        2         1
  90        3         1
 100        4         9
  67        5         9
  80        5         4
  90        4         4

I have tried the query:

select round(avg(value),2) as avg_mark 
from Mark;

expected output

I have tried the following code, it executes successfully and gives the desired result, however it fails to clear test case and IDK why?

Janez Kuhar
  • 3,705
  • 4
  • 22
  • 45
  • 2
    Please see [Tips for asking a good Structured Query Language (SQL) question](https://meta.stackoverflow.com/questions/271055/tips-for-asking-a-good-structured-query-language-sql-question/271056#271056). It's not clear what the expected output is. Also please don't use txtspk abbreviations, like "IDK". Consider that the assignment may be to obtain the average mark of each individual student, and then find the highest one of those. – Scratte Apr 24 '21 at 06:58
  • Related [How to find maximum avg](https://stackoverflow.com/questions/8050854/how-to-find-maximum-avg) – Scratte Apr 24 '21 at 07:34

1 Answers1

0

select max(round(avg(value), 2)) avg_mark from mark group by student_id;