Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started