SQL Queries



1. Using the job_history table display the employee numbers, department id, and start date, which is the first FRIDAY six months from the start date. Format the dates to appear in the format similar to “Friday the Tenth of January, 1997”.

2. Display using the employees table the employee id, last name, hire date, and salary, of every employee who was hired after 7 June 1994.

3. Write a query to modify the previous query and display the hire dates that are between January 1, 1998 and December 31, 2000.

4. For each Employee in the employees table display the employee_id, job_id, department_id, salary and calculate the number of months between today’s date and the hire_date. Label the column MONTHS BETWEEN. Round the number of months up to the closest whole number.

5. Write a query using the locations table to display the STREET_ADDRESS in uppercase, the CITY in lowercase and the length of the STATE_PROVINCE. Order the results by the POSTAL_CODE.

6. Write a query using the jobs table to display the job id, and job title for job descriptions that have the string ‘present’ or ‘hip’ in the job title.

7. Create a query that will display the employee id, manager id and hire date. If the employee does not receive a commission put “No Commission is Paid”. Create an alias for the column.

8. Write query using the locations table that displays the street address and city of all locations based on the value of the column country id as follows:
IT Italy
JP Japan
CN Canada
UK United Kingdom
else display Another Place

9. Display the highest and lowest hire date of all employees in the employees table. Label the columns Largest and Smallest.