Write a query to determine the average marks obtained by students. Order the results in the descending order of average marks. In case the average marks are same for two students, student with a lower student_id should appear first.
Answers
Answer:
I'll try
Explanation:
Sorry, I am in 6th class, hard for me do you have another question you may please tell me
SQL QUERY
The question has 3 condition
1) average marks obtained by students
2) order the result in the descending order of average marks
3) if the average mark of two students are the same print the lower student_id first
create a table with all the marks of each student
select student_id, name, English, Science, social science, maths, sum(English+science+social science+ maths) as Total, sum(English+science+social science+ maths)/4 as Average from student order by average desc;
This Query will return the new column as Total and Average. it will have the total marks of the student and an average of the students. And the average is arranged by the descending order.
First 2 condition has done.
select Distinct (average) from student st inner join ( select min(student_it)from student group by average)st on st.average=st.average
this query will print the average count is repeating
To Learn More...
- brainly.in/question/11880668