- 20
- 0
- 约 18页
- 2016-09-30 发布于浙江
- 举报
oracle实内容2(共40题)
Part 1
Write a query to display the current date. Label the column Date.
select to_char(sysdate,year-mon-day) “Date”
from dual
2. The HR department needs a report to display the employee number, last name, salary, and salary increased by 15.5% (expressed as a whole number) for each employee. Label the column New Salary. Place your SQL statement in a text file named lab_03_02.sql.
select employee_id,last_name,salary,salary*1.155 new_salary
from employees
3. Run your query in the file lab_03_02.sql.
4. Modify your query lab_03_02.sql to add a column that subtracts the old salary from the new salary. Label the column Increase. Save the contents of the file as lab_03_04.sql. Run the revised query.
select employee_id,last_name,salary,salary*1.155 new_salary,salary*0.155 increase
from employees
……
Write a query that displays the last name (with the first letter uppercase and all other letters lowercase) and the length of the last name for all employees whose name starts with the letters J, A, or M. Give each column an appropriate label. Sort the results by the employees’ last names.
select last_name,length(last_name) length
from employees
where last_name like A% or last_name like J%or last_name like M%
order by last_name
Rewrite the query so that the user is prompted to enter a letter that starts the last name. For example, if the user enters H when prompted for a letter, then the output should show all employees whose last name starts with the letter H.
6. The HR department wants to find the length of employment for each employee. For each employee, display the last name and calculate the number of months between today and the date on which the employee was hired. Label the column MONTHS_WORKED. Order your results by the number of months employed. Round the number of months up to the closest whole number.
Note: Your results will differ.
select last_name,round(months_between(sysdate,hire_date)) MONTHS_WORKED
from employees
order by hire_date desc
您可能关注的文档
最近下载
- 教科版四下科学《植物的生长变化》单元解读(新教材解读).pptx VIP
- 厦门钨业分拆厦钨新能上市的动因及绩效研究.pdf VIP
- 厦门同安事业单位笔试真题2025.docx VIP
- 课题申报:四川方言口传文化的传承普及与乡土记忆重建研究.pdf VIP
- 2025年高考英语热点话题阅读热点时文外刊精读集锦3 春节申遗成功和非物质文化遗产(解析版).docx VIP
- 《入党志愿书空白表格.doc VIP
- 中英文对照 MDCG-2020-1 医疗器械软件的临床评价MDR 性能评价IVDR指南.pdf VIP
- 星玛电梯SI210系统.doc VIP
- 国家科技支撑计划项目建议书-yzxzcom.DOC VIP
- 中华民族共同体概论课件专家版4第四讲 天下秩序与华夏共同体的演进(夏商周时期).pptx VIP
原创力文档

文档评论(0)