Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to find max salary in SQL without using max function?

2 Answers

0 votes
by (119k points)

For SQL Server, here is the syntax to find the maximum salary of the employee table without using MAX () function:

SELECT TOP 1 Salary

FROM Employee_Table

ORDER BY Salary DESC

For SQL Server, here is the syntax to find the maximum salary of the employee table without using MAX () function:

SELECT Salary

FROM Employee_Table

ORDER BY Salary DESC

LIMIT 1

I suggest this SQL Training course by Intellipaat to learn SQL and writing complex SQL queries.

0 votes
by (1.5k points)

To find max salary in sql without using max function we are going to use top keyword and order by in sql.

Select top 1 salary from tablename order by salary desc

Here we are using order by to order the column salary by descending and from that i am selecting the top 1st using top1 .

Related questions

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...