作业
# 1. 查看岗位是teacher的员工姓名、年龄
mysql>select * from t0;
+--------+-----+------------+---------+
| name | age | salary | job |
+--------+-----+------------+---------+
| nick | 18 | 3000.0000 | teacher |
| tank | 19 | 4000.0000 | teacher |
| big | 22 | 5000.0000 | teacher |
| xx | 23 | 23232.0000 | teacher |
| egon | 24 | 4534.0000 | teacher |
| jgnk | 27 | 29900.0000 | teacher |
| jinads | 29 | 32332.0000 | teacher |
| box | 33 | 5232.0000 | teacher |
| jink | 37 | 4000.0000 | teacher |
| jjjj | 39 | 9232.0000 | teacher |
+--------+-----+------------+---------+
# 2. 查看岗位是teacher且年龄大于30岁的员工姓名、年龄
mysql> select name,age from t0 where age>30;
+------+-----+
| name | age |
+------+-----+
| box | 33 |
| jink | 37 |
| jjjj | 39 |
+------+-----+
# 3. 查看岗位是teacher且薪资在9000-1000范围内的员工姓名、年龄、薪资
mysql> select name,age,salary from t0 where salary between 9000 and 10000;
+------+-----+-----------+
| name | age | salary |
+------+-----+-----------+
| jjjj | 39 | 9232.0000 |
+------+-----+-----------+
1 row in set (0.00 sec)
# 4. 查看岗位描述不为NULL的员工信息
mysql> select job from t0 where job is null;
Empty set (0.11 sec)
# 5. 查看岗位是teacher且薪资是10000或9000或30000的员工姓名、年龄、薪资
mysql> select name,age,salary from t0 where job='teacher';
+--------+-----+------------+
| name | age | salary |
+--------+-----+------------+
| nick | 18 | 3000.0000 |
| tank | 19 | 4000.0000 |
| big | 22 | 5000.0000 |
| xx | 23 | 23232.0000 |
| egon | 24 | 4534.0000 |
| jgnk | 27 | 29900.0000 |
| jinads | 29 | 32332.0000 |
| box | 33 | 5232.0000 |
| jink | 37 | 4000.0000 |
| jjjj | 39 | 9232.0000 |
+--------+-----+------------+
# 6. 查看岗位是teacher且薪资不是10000或9000或30000的员工姓名、年龄、薪资
mysql> select name,age,salary from t0 where salary not in (10000,9000,30000);
+--------+-----+------------+
| name | age | salary |
+--------+-----+------------+
| nick | 18 | 3000.0000 |
| tank | 19 | 4000.0000 |
| big | 22 | 5000.0000 |
| xx | 23 | 23232.0000 |
| egon | 24 | 4534.0000 |
| jgnk | 27 | 29900.0000 |
| jinads | 29 | 32332.0000 |
| box | 33 | 5232.0000 |
| jink | 37 | 4000.0000 |
| jjjj | 39 | 9232.0000 |
+--------+-----+------------+
# 7. 查看岗位是teacher且名字是jin开头的员工姓名、年薪
mysql> select name,salary from t0 where job='teacher' and name like 'jin%';
+--------+------------+
| name | salary |
+--------+------------+
| jinads | 32332.0000 |
| jink | 4000.0000 |
+--------+------------+
2 rows in set (0.20 sec)