Exam 1z0-071 All QuestionsBrowse all questions from this exam
Question 49

Examine the description of the EMPLOYEES table:

For each employee in department 90 you want to display:

1. their last name

2. the number of complete weeks they have been employed

The output must be sorted by the number of weeks, starting with the longest serving employee first.

Which statement will accomplish this?

A.

B.

C.

D.

    Correct Answer:

    To accomplish the task described - displaying the last name of each employee in department 90 and the number of complete weeks they have been employed, sorted by the longest serving employee first - we must use the TRUNC function. This is because we need to calculate the number of complete weeks, and TRUNC will ensure that any partial week is not included in the count. Additionally, the result must be ordered in descending order, so the longest serving employees appear first (ORDER BY tenure DESC). Given these requirements, the correct SQL query is option B: SELECT last_name, TRUNC((SYSDATE - hire_date) / 7) AS tenure FROM employees WHERE department_id = 90 ORDER BY tenure DESC;.

Discussion
gabolka

its asking for complete weeks so its B

holdfaststrongly

B. Rounding up gives then employees extra days for their "complete" weeks. B would make more sense.

Arth1989

Are you kidding me? Why paying for incorrect answers? Obviously the answer is B!

DadiJoe

how to filter department = 90 when theres no Department or Dept_ID in the table... All options must be wrong.

BARNABA23

Task ask for number of COMPLETE weeks - so TRUNC , not ROUND function should be used Answer is B

cadcadley

B is correct they said de longuest with means the hightest number of weeks

jfc1

B is the correct because the sorting is DESC

Lee_jong_suk

B is the correct answer

hmatinnn

Answer B. Complete weeks with trunc

lucemqy

B would be more accurate since it does not give extra days by rounding

Orxan_H

B correct

ArslanAltaf

The answer should be changed to A or B because both are correct. By no means C is correct, it violates the last requirement LONGEST SERVING ON TOP.

MIGHTYSTUNNERS

b is correct

ArslanAltaf

A & B, Both are correct. More precise is B. The requirement “output must be sorted by the number of weeks, starting with the longest” means the sorting order MUST be DESC on Tenure (High -- Low) Since in C & D, the order by tenure will adopt ASC by default, it will be from low -High so lowest tenure will be on top of output and highest tenure at bottom.

HassanMkhlalati

Answer is B, complete weeks.

MariGare

I would say A. If we have 5 working days in a week, then Round will give us the correct result. And as we were asked to show employees, who serves longer, first, then we should order by desc. So, I do not understand why correct answer is C ...

Nexes

Answer is B, complete weeks.