sql面试题,请大神解答,急!!!

发布网友

我来回答

2个回答

热心网友

1,select e_name from employee where e_hiredate>to_date('2001-01-01','YYYY-MM-dd') and
e_hiredate<to_date('2003-01-01','YYYY-MM-dd') and dept_id in(select dept_id from depar where comp_id in (select comp_id from comp where comp_name=''));
2,update employee set e_level=e_level+1,e_hiredate=sysdate where dept_id in(select dept_id from deptar where dept_name='监察部')追问您的回答很棒,除了第一个问题少查询了一个e_id,第二个问题的depat误写成deptar外,都能执行!多谢大神帮助了!

热心网友

select e_name,e_id from comp a , depar b , employee c
where a.comp_id = b.comp_id
and b.dept_id = c.dept_id
and b.dept_name = '财务部'
and a.comp_name = ''
and c.e_hiredate >= '20000101' and c.e_hiredate <= '20030101'

update employee
set e_level = 1,e_hiredate=getdate()
where dept_id = (select dept_id from depar where dept_name = '监察部' )追问不好意思,您的第一个问题的日期的20000101这种写法我试了,不行,sql语句不让执行。另外第二题的getdate()也不能用。

不过还是很感谢您的帮助!!谢谢!!祝你好运!

追答可能是sql版本不同的原因吧

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com