subject

MYSQL: Your company has fallen on hard times, and you have to let some of your employees go. You figure it will be easier to fire an entire department all at once so now you want to determine which department itâs going to be.
Information about your employees and department is stored in two tables, Employee and Department, respectively. Here are their structures:
Department
Id: unique department id
Name: department name
Employee
Id: unique employee id
Full_name: employeeâs full name
Department: foreign key referencing department id
Salary: employeeâs salary
To choose the unfortunate department, you set a number of criteria you are willing to get rid of any department that has no more than 5 employees. Among these smaller departments you will consider those where the total salary of all of its employees is maximal. Lastly to make a tough situation more fair, you decide to make the final choice from the remaining departments at random. Thus, youâd like to build the following table of departments:
Select all departments with less than 6 employees
Sort these departments by the total salary of its worker in descending order (in the case of a tie, the department with the greatest number of employees should go first; if itâs still not enough to break a tie, the department with the smallest id should go first)
Cross out the departments at the even row and leave only those in the odd positions to consider them more thoroughly afterwards
Given tables employees and departments, your task is to write a select statement described above. The output should have columns dep_name (the name of the department), emp_number (the number of employees in this department), and total_salary (the sum of all employees' salaries in this department) and be sorted according to the specifications above.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 23:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
question
Computers and Technology, 23.06.2019 20:00
What multimedia system creates an immersive, real-life experience that the user can interact with?
Answers: 1
question
Computers and Technology, 24.06.2019 07:00
Guys do you know sh27 cause he hacked me : ( pidgegunderson my old user
Answers: 2
You know the right answer?
MYSQL: Your company has fallen on hard times, and you have to let some of your employees go. You fi...
Questions
question
Mathematics, 28.12.2019 04:31
question
Business, 28.12.2019 04:31
question
Mathematics, 28.12.2019 04:31
question
Mathematics, 28.12.2019 04:31
Questions on the website: 13722361