Exercises
Most of these questions are adapted from the prior set of exercises.
Improve these queries by joining between tables to obtain more useful results.
Try each question on your own first. Then expand the example solution provided to check your work.
Question 1
Find a list of employees where the salary paid is in the range 70000.
Originally question 12.
SOLUTION
Here is an alternate solution to this question:
Which syntax for the
WHEREclause do you prefer? Why?English is an imprecise language. Technically, the wording of the question implies the following solution – showing just the ID and names of employees who have had a salary in the desired range.
However, knowing the salaries themselves (as in the two queries above) is useful information.
Question 2
Find a list of employees whose salary is not in the range 70000.
Originally question 14.
SOLUTION
Technically, the wording of the question implies the following solution:
Question 3
Find the maximum salary, minimum salary, first name, and last name for employee number 10012.
Originally question 15.
SOLUTION
Question 4
Find the maximum and minimum salary paid to all employees. Include employee names.
Originally question 16.
SOLUTION
Question 5
Find a list of all the job titles held by employee number 499998, and their name. List the job titles in alphabetical order.
Originally question 18.
SOLUTION
Question 6
Now come up with your own interesting question to ask regarding this company and its employees. Then, write a query to answer your question.
Here are some examples…
- Which employee has held the most job titles?
- Who was the youngest employee ever hired by the company, and when did that occur?
- Who were the ten people most recently hired at the company?







