day43作业

 create table people(
     id int auto_increment primary key,
     name varchar(10) not null,
     age int not null,
     salary int not null,
     work varchar(20)
     )charset = utf8;
 

作业:
    1. 查看岗位是teacher的员工姓名、年龄
    select name,age from people where work = 'teacher';
    
    2. 查看岗位是teacher且年龄大于30岁的员工姓名、年龄
    select name,age from people where work = 'teacher' and age >30;
    
    3. 查看岗位是teacher且薪资在9000-1000范围内的员工姓名、年龄、薪资
    select id,name,age,salary from people where work = 'teacher' and salary between 9000 and 10000 ;
    4. 查看岗位描述不为NULL的员工信息
    select * from people where work is not null;
    
    5. 查看岗位是teacher且薪资是10000或9000或30000的员工姓名、年龄、薪资
    select name,age,salary from people where work = 'teacher' and salary in(10000,9000,30000);
    
    6. 查看岗位是teacher且薪资不是10000或9000或30000的员工姓名、年龄、薪资
    select name,age,salary from people where work = 'teacher' and salary not in(10000,9000,30000);
    
    7. 查看岗位是teacher且名字是jin开头的员工姓名、年薪
    select name,salary*12 from people where work = 'teacher' and name like 'jin%';
     
     

猜你喜欢

转载自www.cnblogs.com/Isayama/p/11761735.html