Click here to Skip to main content
15,877,915 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am not able to understand the below question:

Display the empno, ename and salary if salary is incremented by 10% of all employees.

What I have tried:

SQL
select empno, ename, salary from emp _
wher salary = (select * from emp wher salary = salary + 0.1 * salary)

I have no idea if it is 100 % correct or not.
Posted
Updated 2-Oct-23 3:50am
v2
Comments
Richard Deeming 26-Sep-23 6:55am    
... where salary = salary + 0.1 * salary

Even ignoring the typo, the only way that could possibly match a record would be if the salary was zero.

... where salary = (select * from ...

That's never going to work. The sub-query would select multiple columns from multiple rows; the DBMS would have no idea which value you wanted to match.

If you don't understand the question, go back and ask your teacher for clarification.

1 solution

We can't see the actual question your teacher has set you, and the version you show here is lacking in any significant detail, rendering it pretty much unanswerable.

And as Richard has said, your SQL is never going to work.

So start with the question: go back and read it carefully - it almost certainly contains details as to what you need to do and in what order. Then re-read your notes on the last lecture as this is normally relevant to the homework that is set.

If you are still having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900