这是什么SQL查询 [英] what is the sql query for this

查看:65
本文介绍了这是什么SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

table Employee
EmpId
Name
MonthlySalary
DateofJoining

Suggest  a sql server query to find out the employee details whose having salary greater than their yers of experiance

推荐答案

尝试一下

Try something along the lines of
SELECT * FROM Employee WHERE MonthlySalary > DATEDIFF(yy, DateofJoining, GETDATE())

但说实话,如果你不能自己解决这个问题,你就是在申请错误的工作......

But to be honest, if you can't work that out for yourself, you are applying for the wrong jobs...

引用:

你知道如何找到这个答案。今天在采访中向我询问。

do you have idea how to find this answer. It is asked to me today in interview.

如果你认为实际上这是一个错误的问题。



但从逻辑上讲,它要求你写通过比较 DateofJoining 和当前日期之间的年份差异来检查薪水的查询。



演示 - [演示]找到薪水超过经验的员工 [ ^ ]

If you think practically, it is a wrong question.

But logically, it is asked to make you write the query which would check the Salary by comparing the Year difference between the DateofJoining and Current Date.

Demo - [Demo] Find Employees having Salary more than their Experience[^]


检查SQL Server DATEDIFF()函数 [ ^ ]

演示 [ ^ ]

这篇关于这是什么SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆