zoukankan      html  css  js  c++  java
  • 数据库select作业

    作业:

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

      SELECT emp_name,age FROM youku.employee where post = 'teacher';

    2. 查看岗位是teacher且年龄大于30岁的员工姓名、年龄

    SELECT emp_name,age FROM youku.employee where post = 'teacher' and age >30;


    3. 查看岗位是teacher且薪资在9000-1000范围内的员工姓名、年龄、薪资

    SELECT emp_name,age,salary FROM youku.employee where salary>=1000 and salary <=9000;


    4. 查看岗位描述不为NULL的员工信息

    SELECT * FROM youku.employee where post_comment is not null;


    5. 查看岗位是teacher且薪资是10000或9000或30000的员工姓名、年龄、薪资

    SELECT emp_name,age,salary FROM youku.employee where post='teacher' and salary in (1000,9000,30000);


    6. 查看岗位是teacher且薪资不是10000或9000或30000的员工姓名、年龄、薪资

    SELECT emp_name,age,salary FROM youku.employee where post='teacher' and salary <>1000 and salary <>9000 and salary <> 30000  ;

    7. 查看岗位是teacher且名字是jin开头的员工姓名、年薪

    SELECT emp_name,age,salary FROM youku.employee where post='teacher' and emp_name like 'ja%'

    创建的表:

    create table employee(
    id int not null unique auto_increment,
    emp_name varchar(20) not null,
    sex enum('male','female') not null default 'male', # 大部分是男的
    age int(3) unsigned not null default 28,
    hire_date date not null,
    post varchar(50),
    post_comment varchar(100),
    salary double(15,2),
    office int, 
    depart_id int
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8

  • 相关阅读:
    Rust Book 学习记录(Nightly)
    测试
    Web前端研发工程师编程能力飞升之路
    Nginx 部署 Django
    数组组合排列及排序
    nodeJS(windows)新手攻略
    虎说:简约不简单-瀑布流布局
    虎说:bootstrap源码解读(重置模块)
    捉Bug:易车注册页布局小臭虫 附demo
    虎扯:小众玩物 webkit家的滚动条
  • 原文地址:https://www.cnblogs.com/ygy1997/p/11761214.html
Copyright © 2011-2022 走看看