开发者

Display a query with name salary and commission for all employees

开发者 https://www.devze.com 2023-04-12 00:23 出处:网络
I have a question about SQL - this is my code so far: SELECT ename,sal,comm FROM emp ORDER BY sal,commdesc;

I have a question about SQL - this is my code so far:

SELECT ename,sal,comm
FROM emp
ORDER BY sal,comm  desc;
WHERE comm>0;

I need to display the name, salary and commission for all employees who earn commission, and sort the data out in descending order开发者_StackOverflow中文版 of salary and commission.


You have an extra ; in your query, and you need to rearrange things:

Select ename,sal,comm from emp order by sal,comm desc; where comm>0;

should be

Select ename,sal,comm from emp where comm>0 order by sal,comm desc;


you should use order clause at last

Select ename,sal,comm from emp where comm>0 order by sal,comm desc;

this should be your query also see here for further knowledge on this.


Select ename,sal,comm from emp where comm>0 order by sal,comm desc;

What about that?

0

精彩评论

暂无评论...
验证码 换一张
取 消