• 数据库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

  • 相关阅读:
    windows mysql 的myini
    NuGet 程序源包
    链表更新
    程序包需要 NuGet 客户端版本“XXXXX”或更高版本,但当前的 NuGet 版本为“XXXXXXXXXX”
    chrome下调试安卓app 之 ionic
    ionic3 在ios9.0 系统下 会出现ReferenceError:Can't find variable:Intl 错误提示
    抓取html 生成图片
    grunt 打包 分解(并非原创)
    关于 vue 日期格式的过滤
    Android Studio
  • 原文地址:https://www.cnblogs.com/ygy1997/p/11761214.html
Copyright © 2020-2023  润新知