DB Assignment of CHP 5,6,7,9
DB Assignment of CHP 5,6,7,9
ASSIGNMENT
NAME: Muhammad Asif
ROLL#: MCSE-F19-041
2.
Modify the query in lab_05_04.sql to display the minimum,
maximum, sum, and average salary for each job type. Resave
lab_05_04.sql as lab_05_05.sql. Run the statement in
lab_05_05.sql.
Answer:
6. Create a report to display the manager number and the salary of the
lowest-paid employee for that manager. Exclude anyone whose
manager is not known. Exclude any groups where the minimum
salary is $6,000 or less. Sort the output in descending order
ofsalary.
Answer:
8. Create a matrix query to display the job, the salary for that job
based on department number, and the total salary for that job, for
departments 20, 50, 80, and 90, giving each column an
appropriateheading.
Answer:
CHAPTER NO 6
1. Write a query for the HR department to produce the addresses of
all the departments. Use the LOCATIONS and COUNTRIES
tables. Show the location ID, street address, city, state or
province,andcountryintheoutput.Usea
NATURALJOINtoproducetheresults.
Answer:
2. Create a report that displays the employee number, last name, and
salary of all employees who earn more than the average salary.
Sort the results in order of ascendingsalary.
Answer:
3,Write a query that displays the employee number and last name
of all employees who work in a department with any employee
whose last name contains the letter “u.” Save your SQL statement
as lab_07_03.sql. Run yourquery.
Answer:
3. The HR department needs a report that displays the last name,
department number, and job ID of all employees whose department
location ID is1700.Modify the query so that the user is prompted
for a location ID. Save this to a file named
lab_07_04.sql.
Answer:
4. Create a report for HR that displays the last name and salary of
every employee who reports to King.
Answer:
5. Create a report for HR that displays the department number, last
name, and job ID for every employee in the Executivedepartment.
Answer:
6. Modify the query in lab_07_03.sql to display the employee
number, last name, and salary of all employees who earn more
than the average salary, and who work in a department with any
employee whose last name contains a “u.” Resave
lab_07_03.sql as lab_07_07.sql. Run the statement
inlab_07_07.sql
Answer:
CHAPTER NO 9
1. Run the statement in the lab8_1.sql script to build the
MY_EMPLOYEE table to be used for the lab.
Answer: