zoukankan      html  css  js  c++  java
  • 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%';
    
  • 相关阅读:
    关于 UITableView 中 网络获取图片 cell 自适应高度的问题
    iOS开发~CocoaPods使用详细说明
    block的使用
    约数个数
    学习Hibernate的(笔者一共会写四部分)
    八皇后问题
    JAVA(利用jsp+javabean+servlet)实现简易计算器
    学习C++的道路 博主会持续更新的
    高效求解区间约数
    最大化平均值
  • 原文地址:https://www.cnblogs.com/luocongyu/p/11761215.html
Copyright © 2011-2022 走看看