登录mysql(ubuntu)
mysql -uroot -pmysql123
source /home/ubuntu/test.sql
1.按照oracle语句写
select e.name, b.name from emp e, emp b where e.mgr = b.empno;
2.改造
select concat(e.ename, ''s boss is ', b.ename) from emp e, emp b where e.mgr = b.empno;
3.强化,显示king的老板
select concat(e.ename, ''s boss is ', b.ename) from emp e, emp b where e.mgr = b.empno;
4.用sql99的语法
select concat(e.ename, ' 's boss is ', b.ename) from emp e left outer join emp b on e.mgr = b.empno ;
5.滤空纠正
select concat(e.ename, '的老板是', ifnull(b.ename, 'himself') ) from emp e left outer join emp b on e.mgr = b.empno;