Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the following database schema (primary keys are bolded and underlined): Employees(elD; integer, eName: string, age: integer, salary: real) Works(elD: integer, dName: string, startedDate: date,
Consider the following database schema (primary keys are bolded and underlined): Employees(elD; integer, eName: string, age: integer, salary: real) Works(elD: integer, dName: string, startedDate: date, ended: date) Departments(dName: string, budget: real, managerEID: integer) The meaning of these relations is straightforward, for example, the table Works has one record per employee-department pair, such that an employee works for a department for a specific period of time. There are three foreign keys for this database: The attribute elD of the relation Works that references the relation Emplovees The attribute 4Name of the relation Works that references the relation Departments rences the relation The attribute managerEID of the relation Departments that references the relation Employees Write the following queries in SQL. No duplicates should be printed in any of the answers. You should use the SQL keyword DISTINCT only when necessary. Also, the creation of temporary tables is not allowed, i.e., for each question, you must write exactly one SQL statement. Note: You MUST denote the number of each query before your answer. 1. Retrieve the name and budget of every department 2. Retrieve the name and budget of every department with a budget greater than S100,000.00 3. Retrieve the name of every department along with its manager name. 4. Retrieve the name and budget of every department that has more budget than the Data Mining department. Note that Data Mining is a department name. 5. Retrieve the names of each employee who works for both departments of Data Warehouse and the Data Mining. Note that e and Data Mining are 6. Find the name of the departament with the largest amount of budget
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