Question

In: Computer Science

Department (deptID, deptName, location) Employee (empID, empName, deptID, slevel, age) Manager (mgrID, mgrName, deptID) Meeting (mtName,...

Department (deptID, deptName, location) Employee (empID, empName, deptID, slevel, age) Manager (mgrID, mgrName, deptID) Meeting (mtName, time, room, mgrID) Accepted (empID, mtName)

1. Provide CREATE TABLE queries for Employee and Manager with necessary constraints.

2. Get the names of manager conducting a meeting in room ‘CodeBlue’.

3. Get the employee IDs and names of employees who have never taken a part in meeting with a manager named ‘Smith’.

4. Get the department names and the total number of employees in that department, sorted in decreasing order of the number of employees.

5. Get the ID of the employee whose name comes first among all employees (i.e. first in alphabetical order). (hint: you can use ALL keyword for this query)

Solutions

Expert Solution

CREATE TABLE DEPARTMENT(deptId varchar2(6) PRIMARY KEY,deptName varchar2(20), location varChar2(20))

CREATE TABLE EMPLOYEE(empId varchar2(6) PRIMARY KEY,empName varchar2(20),deptId varchar(6) references DEPARTMENT(deptId),slevel INT(2), age INT(3))

CREATE TABLE MANAGER(mgrId varchar2(6) PRIMARY KEY,mgrName varchar2(20),deptId varchar2(6) references DEPARTMENT(deptId))

CREATE TABLE MEETING(mtName varchar2(20) PRIMARY KEY,time DATE,room varchar2(20),mgrId varchar2(6) references MANAGER(mgrId))

CREATE TABLE ACCEPTED(empId varchar2(6) references EMPLOYEE(empId),mtName varchar2(20) references MANAGER(mgrId), PRIMARY KEY(empId,mtName))

Q1. Name of the manager conducting a meeting in the room 'CODEBLUE'

SELECT mgrName from MANAGER where mgrId in (SELECT mgrId from MANAGER where room = 'CODEBLUE')

Q2. Id and Name of the employee from EMPLOYEE who has never taken part in meeting with a manage named SMITH

SELECT empId,empName from Employee where empId NOT IN

(SELECT empId from Accepted where mtName IN

(SELECT mtName from MEETING where mgrId IN

(SELECT mgrId from MANAGER where mgrName = 'SMITH')))

Q3. Department names and total number of employees in that department sorted in decreasing order of the number of the employees.

SELECT deptName as Department_name,COUNT(*) as Total_no_of_employee from DEPARTMENT INNER JOIN EMPLOYEE ON

EMPLOYEE.deptId = DEPARTMENT.deptId

GROUP BY DEPARTMENT.deptId,deptName

ORDER BY Total_no_of_employee DESC

Q4. Get Id of the employee whose name comes first among all employees.

SELECT empId from EMPLOYEE order by empName LIMIT 1


Related Solutions

The location of the surgery department is usually such that it is easily accessible to and...
The location of the surgery department is usually such that it is easily accessible to and from the various surgical patient support departments, such as the intensive care unit (ICU), emergency Department (ED), Labor and delivery (L&D), and other various departments. Several design types are used in surgical services departments, depending on the facility. Please respond to the following question with a minimum of 300 words for your responses. Which OR design plan features a clean central core surrounded by...
List department name, employee id, and employee name for all employees in department name order. Repeat...
List department name, employee id, and employee name for all employees in department name order. Repeat for department #10 only. List the course ID, course name, section, instructor name, day, time, and room for all course sections. List the course ID, course name, section, student ID, and student name for CRN 1003. Display the list in ascending order of student last and first names. DROP TABLE registration; DROP TABLE sections; DROP TABLE courses; DROP TABLE students; DROP TABLE instructors; CREATE...
Your company is initiating a new process for determining department budgets. Your department will be meeting...
Your company is initiating a new process for determining department budgets. Your department will be meeting with the department managers to explain the new process. You will be delivering a presentation on the advantages of budgeting. In the past, the managers were given the budgets for their departments but not involved in the decision making. What budgeting advantages would you include in your presentation? How would you explain the content in a meaningful way as to communicate the value and...
6. Meeting with the employee is the first step in the assessment process. True False 7....
6. Meeting with the employee is the first step in the assessment process. True False 7. Retaining good employees involves: A. motivating them to excel B. compensating them C. appraising them D. all of the above 8. The Equal Pay Act of 1963 protects both men and women from inequality in pay. True False 9. Title VII of the Civil Rights Act of 1964 prohibits employment discrimination based on ____. A. race B. color C. religion D. all of the...
The manager of a supermarket chain wants to determine if the location of the product -...
The manager of a supermarket chain wants to determine if the location of the product - where it is to be displayed - has any effect on the sale of a pet toys. Three different aisle locations are to be considered: the front of the aisle, the middle of the aisle, or the rear-aisle. Twenty-one stores are randomly selected, with 7 stores randomly assigned to sell the pet toy at the front-aisle, the middle-aisle, and the rear-aisle. Front Middle Rear...
Develop an algorithm to implement an employee list with employee ID ,name designation and department using...
Develop an algorithm to implement an employee list with employee ID ,name designation and department using link list and perform the following operation on the list i)add employee details based on department ii)remove employee details iv)count the number of employee in each department
You are the director of a radiology department. During a routine individual meeting with one of...
You are the director of a radiology department. During a routine individual meeting with one of your male staff, the employee tells you that a female employee has been making suggestive remarks to him, and occasionally grabbed and fondled him in a sexual manner. He said he asked her several times to stop this behavior as he was married and did not appreciate the behavior, particularly in a work setting. The behavior continued anyway. The male employee asks you not...
You are the financial manager of Craig Pediatrics Center and you have a meeting with the...
You are the financial manager of Craig Pediatrics Center and you have a meeting with the Board of Directors in a month. You need to create a financial analysis of the organization. You have been asked to create a financial analysis of the organization. You have been asked to compare Craig Pediatrics to other pediatric healthcare organizations in the area to create a trend comparison.   Copy the questions below onto your assignment and provide your responses to the following four...
What are creative ways that you can retain your first employee and ensure you are meeting...
What are creative ways that you can retain your first employee and ensure you are meeting his or her needs? Consider how you can meet or exceed the employee’s “psychological contract.” Also, how would you evaluate the new employee in terms of his or her ability to be a team player?
What are the implications of power sharing for manager-employee relationships?
What are the implications of power sharing for manager-employee relationships?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT