zoukankan      html  css  js  c++  java
  • 数据库对表的操作练习。

    数据对表的操作

    作业:

    1. 查看岗位是teacher的员工姓名、年龄
      2. 查看岗位是teacher且年龄大于30岁的员工姓名、年龄
      3. 查看岗位是teacher且薪资在9000-1000范围内的员工姓名、年龄、薪资
      4. 查看岗位描述不为NULL的员工信息
      5. 查看岗位是teacher且薪资是10000或9000或30000的员工姓名、年龄、薪资
      6. 查看岗位是teacher且薪资不是10000或9000或30000的员工姓名、年龄、薪资
      7. 查看岗位是teacher且名字是jin开头的员工姓名、年薪
    1.#查看岗位是teacher的员工姓名、年龄
    mysql> select name,age from employee where post = 'teacher';  
    +------------+-----+
    | name       | age |
    +------------+-----+
    | alex       |  78 |
    | wupeiqi    |  81 |
    | yuanhao    |  73 |
    | liwenzhou  |  28 |
    | jingliyang |  18 |
    | jinxin     |  18 |
    | 成龙       |  48 |
    +------------+-----+
    
    
    2.#查看岗位是teacher且年龄大于30岁的员工姓名、年龄
    mysql> select name,age from employee where post = 'teacher' and age > 30;
    +---------+-----+
    | name    | age |
    +---------+-----+
    | alex    |  78 |
    | wupeiqi |  81 |
    | yuanhao |  73 |
    | 成龙    |  48 |
    +---------+-----+
    
    
    3.#查看岗位是teacher且薪资在9000-1000范围内的员工姓名、年龄、薪资
    mysql> select name,age,salary from employee where post = 'teacher'and salary > 1000 and salary<9000;
    +-----------+-----+---------+
    | name      | age | salary  |
    +-----------+-----+---------+
    | wupeiqi   |  81 | 8300.00 |
    | yuanhao   |  73 | 3500.00 |
    | liwenzhou |  28 | 2100.00 |
    +-----------+-----+---------+
    
    
    4.# 查看岗位描述不为NULL的员工信息
    mysql> select * from employee where post_comment is not NULL;
    Empty set (0.00 sec)
    
    
    5.#查看岗位是teacher且薪资是10000或9000或30000的员工姓名、年龄、薪资
    mysql> select name,age,salary from employee where salary in (10000,9000,30000);
    +------------+-----+----------+
    | name       | age | salary   |
    +------------+-----+----------+
    | jingliyang |  18 |  9000.00 |
    | jinxin     |  18 | 30000.00 |
    | 成龙       |  48 | 10000.00 |
    +------------+-----+----------+
    
    
    6.#查看岗位是teacher且薪资不是10000或9000或30000的员工姓名、年龄、薪资
    mysql> select name,age,salary from employee where salary not in(10000,9000,30000);
    +-----------+-----+------------+
    | name      | age | salary     |
    +-----------+-----+------------+
    | egon      |  18 |    7300.33 |
    | alex      |  78 | 1000000.31 |
    | wupeiqi   |  81 |    8300.00 |
    | yuanhao   |  73 |    3500.00 |
    | liwenzhou |  28 |    2100.00 |
    | 歪歪      |  48 |    3000.13 |
    | 丫丫      |  38 |    2000.35 |
    | 丁丁      |  18 |    1000.37 |
    | 星星      |  18 |    3000.29 |
    | 格格      |  28 |    4000.33 |
    | 张野      |  28 |   10000.13 |
    | 程咬金    |  18 |   20000.00 |
    | 程咬银    |  18 |   19000.00 |
    | 程咬铜    |  18 |   18000.00 |
    | 程咬铁    |  18 |   17000.00 |
    +-----------+-----+------------+
    
    
    7.# 查看岗位是teacher且名字是jin开头的员工姓名、年薪
    mysql> select name,salary from employee where name like 'jin%';
    +------------+----------+
    | name       | salary   |
    +------------+----------+
    | jingliyang |  9000.00 |
    | jinxin     | 30000.00 |
    +------------+----------+
    
    
  • 相关阅读:
    别人好的资源路径
    是否为微信浏览器,苹果安卓判断
    iframe滚动条置顶
    hadoop之MapReduce WordCount分析
    CentOS FTP服务器权限控制
    linux之sed用法
    hdfs-over-ftp安装与配置
    mysql grant all privileges on
    Notepad++快捷键大全
    coconHashMap实现原理分析
  • 原文地址:https://www.cnblogs.com/WQ577098649/p/11761668.html
Copyright © 2011-2022 走看看