牛客网SQL(偶尔刷)

##比较 <>,!<,!>
##范围 (not) between 低 and 高
##集合 (not) in
##字符 (not) like
##空值 is (not) null
##多条件 and or not
##排序 order by 字段名 [desc降序]
##数量 limit n offset m (n=-1,表示最后一行数据)
##别名 1数据表 别名   2字段名 as 别名

#1查找最晚入职员工的所有信息  
select *
from employees
order by hire_date desc 
limit 1

#2查找入职员工时间排名倒数第三的员工所有信息
select *
from employees
order by hire_date desc 
limit 1 offset 2

#3查找当前薪水详情以及部门编号dept_no 
select a.emp_no, a.salary, a.from_date, a.to_date, b.dept_no
from  salaries a
left join dept_manager b
on a.emp_no=b.emp_no
where a.to_date='9999-01-01' and b.to_date='9999-01-01' 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值