• day 34 作业


       # 创建表
       create table oldboy(
       id int unsigned auto_increment primary key,
       name char(10) not null default 'sb',
       age int not null default 0,
       status enum('teacher','student'),
       wage int not null default 0
       )charset=utf8;
       
       # 插入值
       insert into oldboy (name,age,status,wage) values
       ('nick',25,'teacher',10000),
       ('tank',27,'teacher',5000),
       ('jin_sb',33,'teacher',250),
       ('zekai',31,'teacher',20000),
       ('logan',23,'student',0),
       ('dsb',35,'student',0);
       
       # 查看岗位是teacher的员工姓名、年龄
       select name,age from oldboy where status = 'teacher';
       # 查看岗位是teacher且年龄大于30岁的员工姓名、年龄
       select name,age from oldboy where status = 'teacher' and age>30;
       # 查看岗位是teacher且薪资在9000-1000范围内的员工姓名、年龄、薪资
       select name,age,wage from oldboy where status = 'teacher' and wage between 1000 and 9000;
       # 查看岗位描述不为NULL的员工信息
       select * from oldboy where status not is 'null';
       # 查看岗位是teacher且薪资是10000或9000或30000的员工姓名、年龄、薪资
       select name,age,wage from oldboy where status = 'teacher' and (wage between 1000 and 9000 or wage = 3000);
       # 查看岗位是teacher且薪资不是10000或9000或30000的员工姓名、年龄、薪资
       select name,age,wage from oldboy where status = 'teacher' and wage not in (9000,10000,30000);
       # 查看岗位是teacher且名字是jin开头的员工姓名、年薪
       select name,wage*12 as y_wage from oldboy where status = 'teacher' and name like 'jin%';
    
  • 相关阅读:
    (三) 权限控制 --《springboot与shiro整合》
    (二) shiro集成 --《springboot与shiro整合》
    (一) springboot 项目搭建 --《springboot与shiro整合》
    第四章 编码/加密(学习笔记)
    第三章 授权(学习笔记)
    第二章 身份验证(学习笔记)
    获取小程序码java实现
    paypal退款 java实现
    并发下的数据处理和优化
    Casperjs初体验
  • 原文地址:https://www.cnblogs.com/luocongyu/p/11761215.html
Copyright © 2020-2023  润新知