Skip to content

Practice with dates

Try the following problems on the HR schema in SQL Developer. Use the Oracle documentation when you need help with SQL functions.

  1. Display the date that each employee was hired so that you can see the associated time component. What does the data tell you about the way the date values were inserted?

  2. Display the name of each employee and the year they were hired

  3. Modify the previous query to show the number of employees hired in each year (Requires an aggregate function)

  4. Display the name of each employee and the date of their first salary payment (This will be the last day of the month in which they were hired)

  5. For each employee, display their name and list all the positions they have held in the company showing start and end dates.

  6. Modify the previous query so that results also display the number of months that each position lasted rounded to the nearest whole number of months. (Requires the use of two functions - get the date part working first, then do the formatting)

  7. Display the names of all employees and their length of service in months starting with the person who has worked for the company the longest. (Do the ordering last - get everything else working first)

  8. Find the names of all employees hired since 1st January 2000

  9. Find the names of all employees hired between 1990 and 1999 (inclusive)

  10. Display the name of each employee and the title of their first job with the company. (Use a subquery to get the employee's earliest start date)

Check your answers

Check your answers