Question: 15pts) Consider the following relations: Student(s num: integer, s name: string, major string, level: string, age: integer) Class(c name: string, meets at: string, room: string,
15pts) Consider the following relations: Student(s num: integer, s name: string, major string, level: string, age: integer) Class(c name: string, meets at: string, room: string, fid: integer) Enrolled (s num: integer,c name: string) Faculty(fid: integer, fname: string, deptid: integer) Page: 3 The meaning of these relations is straightforward, for example, Enrolled has one record per student- class pair such that the student is enrolled in the class. Write the following queries in SQL. No duplicates should be printed in any of the answers a. Find the names of all Juniors (level JR) who are enrolled in a class taught by Bob Jones b. Find all the related student information with student's age greater than 18 years old. c. Find out the classes that are taught at room ALU106. The needed class information are the schedule (meets at), the class name and faculty name who teaches the class. We would like the result is ordered by the schedule 5. (20pts) Consider the following relational schema. An employee can work in more than one department; the pct time field of the Works relation shows the percent-age of time that a given employee works in a given department. Empleid: integer, ename: string, age: integer, salary: real) Works(eid: integer, did: integer, pct_ time: integer) Dept(did: integer, dname: string, budget: real, managerid: integer) 1). Print the names and salary of each employee who works in more than one department. 2). For each department with 20 or more employees, print the department name and the number of employees that work in that department 3). Find the managers' name and the department name that the managers manage the departments with budgets greater than $2 million. 4). Find the name and age of managers who manage the departments with the largest budgets, and list the related employees in the department. Write the following queries in SQL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
