• database homework1


    mysql> select * from teacher_info;
    +----+------+-----+--------+---------+
    | id | name | age | salary | job     |
    +----+------+-----+--------+---------+
    |  1 | nick |  18 |  30000 | teacher |
    |  2 | tank |  18 |  28000 | teacher |
    |  3 | echo |  30 |  50000 | teacher |
    |  4 | egon |  50 |   8000 | teacher |
    +----+------+-----+--------+---------+
    	1. 查看岗位是teacher的员工姓名、年龄
    mysql> select name,age from teacher_info where job = 'teacher';
    	2. 查看岗位是teacher且年龄大于30岁的员工姓名、年龄
    mysql> select name,age from teacher_info where age >30;
    +------+-----+
    | name | age |
    +------+-----+
    | egon |  50 |
    +------+-----+
    1 row in set (0.00 sec)
    
    	3. 查看岗位是teacher且薪资在5000-10000范围内的员工姓名、年龄、薪资
    mysql> select name,age,salary from teacher_info where job = 'teacher' and (salary between 5000 and 10000);
    +------+-----+--------+
    | name | age | salary |
    +------+-----+--------+
    | egon |  50 |   8000 |
    +------+-----+--------+
    1 row in set (0.00 sec)
    	4. 查看岗位描述不为NULL的员工信息
    mysql> select * from teacher_info where job != null;
    Empty set (0.00 sec)
    	5. 查看岗位是teacher且薪资是10000或8000或30000的员工姓名、年龄、薪资
    mysql> select name,age,salary from teacher_info where salary in (10000,8000,30000);
    +------+-----+--------+
    | name | age | salary |
    +------+-----+--------+
    | nick |  18 |  30000 |
    | egon |  50 |   8000 |
    +------+-----+--------+
    2 rows in set (0.33 sec)
    	6. 查看岗位是teacher且薪资不是10000或8000或30000的员工姓名、年龄、薪资
    mysql> select name,age,salary from teacher_info where salary not in (10000,8000,30000);
    +------+-----+--------+
    | name | age | salary |
    +------+-----+--------+
    | tank |  18 |  28000 |
    | echo |  30 |  50000 |
    +------+-----+--------+
    2 rows in set (0.00 sec)
    	7. 查看岗位是teacher且名字是jin开头的员工姓名、年薪
    mysql> select name,salary from teacher_info where name = 'jin%';
    Empty set (0.00 sec)
    
  • 相关阅读:
    有几个PAT
    数组模拟求阶乘
    从程序员到架构师转变
    [评论]去360还是留在百度?
    PHPCMS V9模板制作进阶教程之常用PC标签大全
    phpcms v9 如何用PC标签在列表页中同时调出文章内容
    PHP创建缩略图造成图片质量低下的完美解决方法
    Jquery关闭离开页面时提醒
    天猫启动了旗舰店升级品牌商城计划 天猫商城旗舰店向自主B2C模式转型
    shopex模板编辑说明文档
  • 原文地址:https://www.cnblogs.com/agsol/p/11760126.html
Copyright © 2020-2023  润新知