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

  • 相关阅读:
    常用正则表达式
    玉洁哥的设计模式指摘
    jquery makearray()使用
    html/css技巧总结
    json 数组 对象 xml 之间转换(待补充)
    Html5 Geolocation获取地理位置信息
    JSON.stringify 应用
    url操作一网打尽(一)
    jquery选择器
    JavaScript Window Location
  • 原文地址:https://www.cnblogs.com/ygy1997/p/11761214.html
Copyright © 2011-2022 走看看