查出所有员工的名字,薪资,格式为
<名字:egon>,<薪资:3000>
mysql> select concat('<姓名:',name,'>') as name_info , concat('<薪资:',salary,'>') as salary_info from employee;
+---------------------+---------------------+
| name_info | salary_info |
+---------------------+---------------------+
| <姓名:alex> | <薪资:1000000.31> |
| <姓名:yuanhao> | <薪资:3500.00> |
| <姓名:liwenzhou> | <薪资:2100.00> |
| <姓名:jingliyang> | <薪资:9000.00> |
| <姓名:jinxin> | <薪资:30000.00> |
| <姓名:成龙> | <薪资:10000.00> |
| <姓名:歪歪> | <薪资:3000.13> |
| <姓名:丫丫> | <薪资:2000.35> |
| <姓名:丁丁> | <薪资:1000.37> |
| <姓名:星星> | <薪资:3000.29> |
| <姓名:格格> | <薪资:4000.33> |
| <姓名:张野> | <薪资:10000.13> |
| <姓名:程咬金> | <薪资:20000.00> |
| <姓名:程咬银> | <薪资:19000.00> |
| <姓名:程咬铜> | <薪资:18000.00> |
| <姓名:程咬铁> | <薪资:17000.00> |
+---------------------+---------------------+
16 rows in set (0.00 sec)
2
查出所有的岗位(去掉重复)
mysql> select distinct post from employee;
+-----------+
| post |
+-----------+
| teacher |
| sale |
| operation |
+-----------+
3 rows in set (0.00 sec)
3 查出所有员工名字,以及他们的年薪,年薪的字段名为annual_year
mysql> select name,salary*12 as annual_year from employee;
+------------+-------------+
| name | annual_year |
+------------+-------------+
| alex | 12000003.72 |
| yuanhao | 42000.00 |
| liwenzhou | 25200.00 |
| jingliyang | 108000.00 |
| jinxin | 360000.00 |
| 成龙 | 120000.00 |
| 歪歪 | 36001.56 |
| 丫丫 | 24004.20 |
| 丁丁 | 12004.44 |
| 星星 | 36003.48 |
| 格格 | 48003.96 |
| 张野 | 120001.56 |
| 程咬金 | 240000.00 |
| 程咬银 | 228000.00 |
| 程咬铜 | 216000.00 |
| 程咬铁 | 204000.00 |
+------------+-------------+
16 rows in set (0.00 sec)