Class Practical 3 - Chapter 3 Questions
Class Practical 3 - Chapter 3 Questions
Class Practical 3 - Chapter 3 Questions
2. Display the employee number and name for all employees who earn less than the average
salary.
3. Display comprehensive details for all employees who work in NEW YORK.
4. Display the employee name for all employees who earn less than the highest salary in
salary grade four and work in Dallas.
5. Display the department number and name for all employees whose name begins with a T
and who earn a bonus.
6. Display the department number for the department with the highest average salary across
all departments.
CHALLENGE QUESTIONS
7. Display the employee number, employee name, department number and salary for all
employees who earn more than the average salary in their own department. Sort the output
by salary within department number.
8. Display the department number and the length of service (in years) for the person who has
served the longest within the department. Exclude the department where the longest
serving person has less service than the longest serving person in all other departments.
9. Display the job (e.g. CLERK) and the average salary of all people in that job where at least
two people do that job. Exclude jobs where the average salary is greater than the job with
the lowest average salary.
1
INF313 – CLASS PRACTICAL 3
Chapter 3 – Table Creation and Management
10. Display the department number and the number of people in that department where at
least one person in that department earns a commission (Hint: EXISTS could be used –
correlated subquery).
4. Select all the data of employees whose last name is "Smith" or "Doe".
6. Select all the data of employees that work in department 37 or department 77.
7. Select all the data of employees whose last name begins with an "S".
9. Select the number of employees in each department (you only need to show the
department code and the number of employees).
10. Reassign all employees from the Research department (code 77) to the IT.
2
INF313 – CLASS PRACTICAL 3
Chapter 3 – Table Creation and Management
2. Select the names and the prices of all the products in the store.
3. Select the name of the products with a price less than or equal to $200.
4. Select all the products with a price between $60 and $120.
5. Select the name and price in cents (i.e., the price must be multiplied by 100).
7. Compute the average price of all products with manufacturer code equal to 2.
8. Compute the number of products with a price larger than or equal to $180.
9. Select the name and price of all products with a price larger than or equal to $180, and sort
first by price (in descending order), and then by name (in ascending order).
10. Select the average price of each manufacturer's products, showing only the manufacturer's
code.
14. Apply a 10% discount to all products with a price larger than or equal to $120.