You are on page 1of 4

1

SQL statements and answers

Student name

Institutional Affiliation

Course

Date
2

Using the image the structured query language (SQL), statements and images would
involve seven different steps.

Step 1/7
1.SELECT emp_last_name, emp_first_name, state, gender FROM employees
answer> (Select work_emp_ssn, avg(Work_Hours) 'Avg_Work_Hours' from Assignment where
work_pro_number in (1,2,3) group by work_emp_ssn) A
on A.work_emp_ssn = e.emp_ssn;
Step 2/7
2.SELECT dpt_name, highest_average_salary FROM departments
(Select emp_dpt_number, Max(emp_date_of_birth) as Youngest_DOB  from employee)a
on A.emp_dpt_number = e.emp_dpt_number;
Step 3/7
3.SELECT * FROM employees WHERE dpt_name='department' AND
highest_average_salary>=EMP.salary
Top 1 is utilized to retrieve a single record, and ordering by avg(e.emp_salary) desc will provide
you with the department's maximum average salary. To obtain the department name from dpt_no,
we additionally joined the Department table.
Step 4/7
4.SELECT * FROM departments WHERE dpt_name='department'
the e.emp_last_name option e.emp_first_name and LastName a.work_pro_number, FirstName
ProjectNumber,

a.workhours from employee 

e left join assignment a 

on a.work_emp_ssn = e.emp_ssn 

where a.workhours is null 

order by e.emp_last_name, e.emp_first_name a.workhours is null also left join is used to give all
the employees' names regardless of whether they were assigned or not.
Step 5/7
Choose employee e, s.emp_last_name, and d.dpt_name from the list of employees.
3

Internal staff members

on e.emp_superssn = s.emp_ssn

Department d's inner join

d.dpt_no = s.emp_dpt_number

in which d.dpt_no = 7

Step6/7

when emp_gender = "F" and emp_state = "CA," extract emp_last_name, emp_first_name, and
emp_state from the employee table.

Step 7/7

from assignment, choose work_emp_ssn, work_pro_number, and work_hours

where work_hours exceed 15 and work_pro_number is either 1 or 2;


4

Reference

Banerjee, P. S., Chakraborty, B., Tripathi, D., Gupta, H., & Kumar, S. S. (2019). A information
retrieval based on question and answering and NER for unstructured information without
using SQL. Wireless Personal Communications, 108, 1909-1931.

You might also like