• day 34 作业


    PS C:WINDOWSsystem32> mysql -uroot -p
    Enter password:
        
    mysql> use feng;
    Database changed 
    
    mysql> create table infor(
        -> id int unsigned auto_increment primary key,
        -> name varchar(10) not null default 'xxx',
        -> age int not null default 0,
        -> salary decimal(10,2) not null default 0,
        -> work varchar(20) not null default 'xxx'
        -> )charset=utf8;
    
    
    mysql> insert into infor (name,age,work,salary) values
        -> ('nick',22,'teacher',9999.99),
        -> ('jing',32,'teacher',10000.00),
        -> ('tank',20,'teacher',12000);
    

    1.查看岗位是teacher的员工姓名、年龄

    mysql> select name,age from infor where work='teacher';
    
    1. 查看岗位是teacher且年龄大于30岁的员工姓名、年龄

       select name,age from infor where work='teacher' and age>30;
      
    2. 查看岗位是teacher且薪资在9000-10000范围内的员工姓名、年龄、薪资

      mysql> select name,age,salary from infor where work='teacher' and salary between 9000 and 10000;
      
    3. 查看岗位描述不为NULL的员工信息

      mysql> select * from infor where work is not null;
      
    4. 查看岗位是teacher且薪资是10000或9000或30000的员工姓名、年龄、薪资

      mysql> select name,age,salary from infor where salary=10000 or salary=9000 or salary=30000;
      
    5. 查看岗位是teacher且薪资不是10000或9000或30000的员工姓名、年龄、薪资

      mysql> select name,age,salary from infor where salary!=10000 and salary!=9000 and salary!=30000;
      
    6. 查看岗位是teacher且名字是jin开头的员工姓名、年薪

    mysql> select name,salary*12 as year_salary from infor where name like 'jin%';
    
  • 相关阅读:
    linux 静态库和动态库(共享库)的制作与使用
    实现linux mkdir命令
    行间距和文本样式
    单位和字体
    html标签2
    css层叠样式表
    html标签
    html简介
    数据数组
    Redis的使用
  • 原文地址:https://www.cnblogs.com/zqfzqf/p/11760899.html
Copyright © 2020-2023  润新知