7.5 - Specify the following additional queries on the database of Figure 5.5 in SQL. Show...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
7.5 - Specify the following additional queries on the database of Figure 5.5 in SQL. Show the query results if applied to the database of Figure 5.6. (a) For each department whose average employee salary is more than $30,000, retrieve the department name and the number of employees working for that department. (b) Suppose we want the number of male employees in each department rather than all employees (as in Exercise 7.5a). Can we specify this query in SQL? Why or why not? EMPLOYEE Fname Minit Lname Ssn Bdate Address Sex Salary Super_ssn Dno DEPARTMENT Dname Dnumber Mgr_ssn Mgr_start_date DEPT_LOCATIONS Dnumber Dlocation PROJECT Pname Pnumber Plocation Dnum WORKS ON Essn Pno Hours DEPENDENT Essn Dependent_name Sex Bdate Relationship Figure 5.5 Schema diagram for the COMPANY relational database schema. 7.6 - Specify the following queries in SQL on the database schema of Figure 1.2. (a) Retrieve the names and major departments of all straight-A students (students who have a grade of A in all their courses). (b) Retrieve the names and major departments of all students who do not have any grade of A in any of their courses. Figure 1.2 A database that stores student and course information. STUDENT Name Smith Brown COURSE Course_name Intro to Computer Science Data Structures Discrete Mathematics Database Student number 17 8 85 92 102 112 119 135 GRADE REPORT Student number 17 17 8 8 8 PREREQUISITE Course number CS3380 CS3380 CS3320 Class 1 Course number CS1310 CS3320 MATH2410 CS3380 SECTION Section identifier Course_number Semester Year Instructor 07 King MATH2410 CS1310 CS3320 MATH2410 CS1310 CS3380 Anderson Knuth Chang Anderson 08 Stone 07 08 08 08 Section identifier 112 119 92 102 135 Major CS CS Fall Fall Spring Fall Fall Fall Prerequisite_number CS3320 MATH2410 CS1310 Credit hours 4 4 3 3 Grado B A A Department CS CS MATH CS B A 7.7 - In SQL, specify the following queries on the database specified in Figure 5.5 using the concept of nested queries and the concepts described in this chapter. a. Retrieve the names of all employees who work in the department that has the employee with the highest salary among all employees. b. Retrieve the names of all employees whose supervisor's supervisor has '888665555' for Ssn. min c. Retrieve the names of employees who make at least $10,000 more than the employee who is paid the least in the company. EMPLOYEE Fname Minit Lname Ssn Bdate Address Sex Salary DEPARTMENT Dname Dnumber Mgr_ssn Mgr_start_date DEPT_LOCATIONS Dnumber Dlocation PROJECT Pname Pnumber Plocation Dnum WORKS ON Essn Pho Hours DEPENDENT Essn. Dependent_name Sex Bdate Relationship Super_ssn Dno Figure 5.5 Schema diagram for the COMPANY relational database schema. 7.5 - Specify the following additional queries on the database of Figure 5.5 in SQL. Show the query results if applied to the database of Figure 5.6. (a) For each department whose average employee salary is more than $30,000, retrieve the department name and the number of employees working for that department. (b) Suppose we want the number of male employees in each department rather than all employees (as in Exercise 7.5a). Can we specify this query in SQL? Why or why not? EMPLOYEE Fname Minit Lname Ssn Bdate Address Sex Salary Super_ssn Dno DEPARTMENT Dname Dnumber Mgr_ssn Mgr_start_date DEPT_LOCATIONS Dnumber Dlocation PROJECT Pname Pnumber Plocation Dnum WORKS ON Essn Pno Hours DEPENDENT Essn Dependent_name Sex Bdate Relationship Figure 5.5 Schema diagram for the COMPANY relational database schema. 7.6 - Specify the following queries in SQL on the database schema of Figure 1.2. (a) Retrieve the names and major departments of all straight-A students (students who have a grade of A in all their courses). (b) Retrieve the names and major departments of all students who do not have any grade of A in any of their courses. Figure 1.2 A database that stores student and course information. STUDENT Name Smith Brown COURSE Course_name Intro to Computer Science Data Structures Discrete Mathematics Database Student number 17 8 85 92 102 112 119 135 GRADE REPORT Student number 17 17 8 8 8 PREREQUISITE Course number CS3380 CS3380 CS3320 Class 1 Course number CS1310 CS3320 MATH2410 CS3380 SECTION Section identifier Course_number Semester Year Instructor 07 King MATH2410 CS1310 CS3320 MATH2410 CS1310 CS3380 Anderson Knuth Chang Anderson 08 Stone 07 08 08 08 Section identifier 112 119 92 102 135 Major CS CS Fall Fall Spring Fall Fall Fall Prerequisite_number CS3320 MATH2410 CS1310 Credit hours 4 4 3 3 Grado B A A Department CS CS MATH CS B A 7.7 - In SQL, specify the following queries on the database specified in Figure 5.5 using the concept of nested queries and the concepts described in this chapter. a. Retrieve the names of all employees who work in the department that has the employee with the highest salary among all employees. b. Retrieve the names of all employees whose supervisor's supervisor has '888665555' for Ssn. min c. Retrieve the names of employees who make at least $10,000 more than the employee who is paid the least in the company. EMPLOYEE Fname Minit Lname Ssn Bdate Address Sex Salary DEPARTMENT Dname Dnumber Mgr_ssn Mgr_start_date DEPT_LOCATIONS Dnumber Dlocation PROJECT Pname Pnumber Plocation Dnum WORKS ON Essn Pho Hours DEPENDENT Essn. Dependent_name Sex Bdate Relationship Super_ssn Dno Figure 5.5 Schema diagram for the COMPANY relational database schema.
Expert Answer:
Related Book For
Fundamentals of Database Systems
ISBN: 978-0136086208
6th edition
Authors: Ramez Elmasri, Shamkant Navathe
Posted Date:
Students also viewed these databases questions
-
Specify the following queries on the database in Figure 5.5 in SQL. Show the query results if each query is applied to the database state in Figure 5.6. a. For each department whose average employee...
-
Repeat Laboratory Exercises 8.34 through 8.38 in domain relational calculus (DRC) by using the DRC interpreter. Exercises 8.34 Specify and execute the following queries in relational algebra (RA)...
-
Is the converse of the second part of Theorem 5.7 true? That is, if a function is one-to-one (and therefore has an inverse function), then must the function be strictly monotonic? If so, prove it. If...
-
At each indicated point find (a) The slope of the tangent line, and (b) The instantaneous rate of change of the function. 1. y = (x2 + 1) (x3 - 4x) at (- 2, 0) 2. y = (x3 - 3) (x2 - 4x + 1) at (2, -...
-
In which two situations do decision tables work best?
-
A partner in your firm has just been offered an appointed to the board of a public listed company that is significantly owned by an overseas shareholder. She has asked you to write her some notes...
-
Ehler Corporation sells rock-climbing products and also operates an indoor climbing facility for climbing enthusiasts. During the last pan of 2017, Ehler had the following transactions related to...
-
The amount of realized gain to be recognized in a tax year is equal to the gross profit multiplied by the ratio of payments received in the current year divided by the total contract price. ...
-
What is an eccentric riveted joint? Explain the method adopted for designing such a joint? A bracket, attached to a vertical column by means of four identical rivets, is subjected to an eccentric...
-
Provide an example, with rationale, of an area in your personal life where you would like to apply time value of money concepts. What can you do to create a more financially sound future for yourself?
-
Cristina-Carlos Company manufactures various health products. The company is contemplating continuing to make the product with a new machine or buying the finished product from an outside vendor....
-
How do microorganisms engage in inter-kingdom signaling to establish symbiotic relationships with plants, and what are the implications for agriculture and environmental remediation strategies?
-
Provide the definition of the bullwhip effect and cite your source for it. Also, in a bulleted list, identify what can mitigate the bullwhip effect and cite your source for it (it can be from the...
-
Answer questions 1 -8 for a $250,000 home purchase using a conventional fixed rate mortgage from a private lender. Reminder: mortgage payments are monthly so use monthly compounding for all mortgage...
-
Emily owns a flower shop. Their monthly revenue is usually constant, except in the month of May, they made arrangements for a large wedding. In the month of February, there was a major snowstorm that...
-
Instant message about flight cancellations at United Airlines. It used to be that airline passengers didnt learn about canceled connecting flights until after theyd landed. Sometimes a captain would...
-
Refer to the Conservation Ecology (Dec. 2003) study of the causes of forest fragmentation, presented in Exercise 2.166 (p. 97). Recall that the researchers used advanced high-resolution satellite...
-
Show that, if the matrix S resulting from Algorithm 15.3 does not have a row that is all "a" symbols, then projecting S on the decomposition and joining it back will always produce at least one...
-
What is the difference between controlled and uncontrolled redundancy?
-
Calculate the cost functions for different options of executing the JOIN operation OP7 discussed in section 19.3.2.
-
Suppose you have \($1000\) in average daily sales. Your payment processor offers you a cash advance of \($20,000\) with a factor rate of 1.12 and a 10% holdback rate. What is the total amount you...
-
The Row Cannery wants to borrow \($2\) million for one month. Using its inventory as collateral, it can obtain a 12% (APR) loan. The lender requires that a warehouse arrangement be used. The...
-
Assume that Timmons Towel and Diaper Services bank pays 1% (APR with quarterly compounding) on its compensating balance accounts. What is the EAR of Timmonss three-month loan?
Study smarter with the SolutionInn App