SELECT lastname salary ROUNDsalary1552 Calculated Salary FROM employees WHERE

Select lastname salary roundsalary1552 calculated

This preview shows page 1 - 4 out of 4 pages.

SELECT last_name, salary, ROUND(salary/1.55,2) "Calculated Salary" FROM employees WHERE employee_id BETWEEN 100 AND 102; 2. Display employee last_name and salary for those employees who work in department 80. Give each of them a raise of 5.333% and truncate the result to two decimal places. SELECT last_name, salary, TRUNC(salary*1.0533,2) "Raised Salary" FROM employees WHERE department_id = 80;
Image of page 1
3. Use a MOD number function to determine whether 38873 is an even number or an odd number. SELECT CASE WHEN MOD(38873 , 2) = 1 THEN 'odd' ELSE 'even' END as "Odd or Even?" FROM dual; Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. 2 4. Use the DUAL table to process the following numbers: 845.553 - round to one decimal place 30695.348 - round to two decimal places 30695.348 - round to -2 decimal places 2.3454 - truncate the 454 from the decimal place SELECT ROUND( 845.553 , 1) FROM dual; 845.6 SELECT ROUND( 30695.348 , 2) FROM dual; 30695.35 SELECT ROUND( 30695.348 , -2) FROM dual; 30700 SELECT TRUNC( 2.3454 , 1) FROM dual; 2.3
Image of page 2
5. Divide each employee’s salary by 3. Display only those employees’ last names and salaries who earn a salary that is a multiple of 3. SELECT last_name, salary FROM employees WHERE MOD(salary, 3) = 0; 6. Divide 34 by 8. Show only the remainder of the division. Name the output as EXAMPLE. SELECT MOD(34, 8) as example FROM dual; 7. How would you like your paycheck – rounded or truncated? What if your paycheck was calculated to be $565.784 for the week, but you noticed that it was issued for $565.78. The loss of .004 cent would probably make very little difference to you. However, what if this was done to one thousand people, one hundred thousand people, or one million people! Would it make a difference then? How much of a difference? 1K: $4 , 100K : $400, 1000K (1 million) : $4000 SELECT (565.784 - ROUND(565.784, 2))*1000*(:xx) as diff FROM dual;
Image of page 3
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
Image of page 4

You've reached the end of your free preview.

Want to read all 4 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture