The names and marks of the top three students are obtained using a SELECT statement. The following SQL statement is used to determine the column in a table's given records with the highest value:
SELECT TOP N * FROM table_name ORDER BY column_name DESC;
You can write the query.
SELECT TOP 3* FROM students ORDER BY marks DESC;
if you want to learn more about databases, for example, Oracle Database you can join
Oracle Online Course and solve these questions easily hope you like this
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
We can get name and marks of top 3 students as follows:
SELECT TOP 3 * FROM table_name ORDER BY column_name;
The names and marks of the top three students are obtained using a SELECT statement. The following SQL statement is used to determine the column in a table's given records with the highest value:
SELECT TOP N * FROM table_name ORDER BY column_name DESC;
You can write the query.
SELECT TOP 3* FROM students ORDER BY marks DESC;
if you want to learn more about databases, for example, Oracle Database you can join Oracle Online Course and solve these questions easily hope you like this
SQL SELECT Highest value:
To find the highest value from given records of column in a table then the following SQL statement is used for it,
SELECT TOP N * FROM table_name ORDER BY column_name DESC;
And find the min value from that table then,
SELECT TOP N * FROM table_name ORDER BY column_name ;(or ASC ;)
Example:
Lets have a database table ‘Students’ that store the record of students.
The following SQL statement is used to find the records of 3 students who get the highest marks.
select top 3 stuName, stuMarks from Students order by stuMarks desc;