Q1) Write a query to display name of employee who was the last one hired in depa
ID: 3640653 • Letter: Q
Question
Q1) Write a query to display name of employee who was the last one hired in department 10. Q2) Write a query to display employee names, department name, employee grade for those whose salaries are less than 1500. Q3) Write a query to display employee name, his grade, his department name for those whose salaries are greater than average. Q4) Write SQL command to display name of the department that has the employee who gets the highest salary.Explanation / Answer
Please find below the table structure, Insert Script and query. Kindly rate. Table Structure: CREATE TABLE Employee( EmployeeID Numeric, EmployeeName Varchar(10), EmployeeDOJ Date, salary Numeric, grade Varchar(1), departmentID numeric) Create table department ( departmentid numeric, departmentname Varchar(10) ) Insert Script insert into EMPLOYEE (EMPLOYEEID, EMPLOYEENAME, EMPLOYEEDOJ, SALARY, GRADE, DEPARTMENTID) values (1, 'aaa', '11/12/2011', 1000, 'A', 1) insert into EMPLOYEE (EMPLOYEEID, EMPLOYEENAME, EMPLOYEEDOJ, SALARY, GRADE, DEPARTMENTID) values (2, 'bbb', '11/11/2011', 2000, 'B', 1) insert into EMPLOYEE (EMPLOYEEID, EMPLOYEENAME, EMPLOYEEDOJ, SALARY, GRADE, DEPARTMENTID) values (3, 'ccc', '11/10/2011', 3000, 'C', 1) insert into DEPARTMENT (DEPARTMENTID, DEPARTMENTNAME) values (1, 'dep1') Select Query Query 1 Select EmployeeName from Employee where EmployeeDOJ >= (select max(EmployeeDOJ) from Employee) Query 2 select EmployeeName,Departmentname,Grade from Employee,Department where salary < 1500 Query 3 select EmployeeName,Departmentname,Grade from Employee,Department where salary > (select avg(salary) from Employee) Query 4 select Departmentname from Employee,Department where salary >= ((select max(salary) from Employee))Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.