max query not working

SELECT Professor_Name, Salary FROM SALARIES WHERE Salary > (SELECT MIN(Salary) FROM SALARIES) * 4;
why above query not working
please advise
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
Above query is syntactically correct and kindly explain why you mentioned it is not working either it is not returning the expected results or something else..

FYI, above query is trying to get list of all professor names whose salary is higher than 4 times the minimum salary across all professors.
If you want to calculate something else, kindly let us know so that we can help modify the query..

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Geert GOracle dbaCommented:
a query which returns no rows works
a query which gives a syntax error doesn't work

if it didn't work, what error did you get ?
slightwv (䄆 Netminder) Commented:
It appears you want anyone making more than 4 times the minimum salary.

Every time you think you need to select from the same table again, especially in an inline query, stop and rethink it.

See if this works for you:
SELECT Professor_Name, Salary from (
	SELECT Professor_Name, Salary, min(salary) over() * 4 four_time_min FROM SALARIES
) salaries
where salary > four_time_min
/

Open in new window


With all the new questions, I understand you are learning SQL.  The WINDOW functions are very powerful once you understand the syntax and what they are doing.

I suggest spending some time in the documentation and other online examples.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.