Assuming you have a table named "student" with columns "name" and "marks", you can write a SQL query to display the maximum and minimum marks of all students in the following way:
SELECT MAX(marks) as max_marks, MIN(marks) as min_marks FROM student;
In this SQL query, we are using the "MAX" and "MIN" functions to get
the maximum and minimum marks respectively from the "marks" column of the "student" table. We
are also using the "AS" keyword to rename the columns in the output as "max_marks" and
"min_marks" respectively.
When you run this SQL query, it will return a single row with two
columns: the maximum marks in the "max_marks" column, and the minimum marks in the "min_marks"
column. This will give you an overview of the highest and lowest marks obtained by students in
the table.
You can also add additional conditions to the SQL query, such as
filtering by specific subjects or grades, or ordering the results in a specific way. For
example:
SELECT MAX(marks) as max_marks, MIN(marks) as min_marks FROM student WHERE subject = 'Mathematics' ORDER BY max_marks DESC;In this modified SQL query, we are adding a condition to only select the
maximum and minimum marks for the "Mathematics" subject. We are also ordering the results in descending
order based on the maximum marks column, so that the highest marks appear first in the output.