Computer Science, asked by brameswarpatro123, 10 months ago

Write a query to display list student id and the minimum mark scored by that students in any subject.Give an alias as minimum_mark. Sort the result based on minimum_mark
(where there is a student table in which in student table student id i spresent and in the mark table value , subject id ,student id is present.)

Answers

Answered by suchindraraut17
3

List the student details based on minimum marks

Explanation:

This query is created in the SQL server.

 

SELECT  S.StudentId,

               M.Marks[minimum_mark]  

               FROM STUDENT S

               INNER JOIN MARK M ON S.StudentId = M.StudentId

               WHERE M.Marks < 31

               ORDER BY StudentId

In the above query, I have given condition display list of all StudentId and minimum_marks, if student marks are less than 31 and I have applied join also based on similar data from two tables.  

I have also used ORDER BY to sort data in ascending order based on StudentId.

You can give any number as per your requirement for minimum marks.

Answered by samikshak
4

Answer:

select student_id,min(value) as minimum_mark

from mark

group by student_id

order by minimum_mark;

Explanation: Select the id and min of the value give the required alias then group by the id and sort by the new alias column as asked in the question.

Similar questions