1.写SQL雇员中谁的工资最高。
错误代码:
select ename,max(sal) from emp;
正确答案:
select ename from emp where sal=(select max(sal) from emp);
select ename from emp order by sal desc limit 1;
select ename from (select * from emp order by sal desc) where rownum<=1;//取第一行
查询时,既有普通字