Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose the following tables are part of a project management database of a company, where keys are bold: E( ssn , name, salary) stores the

Suppose the following tables are part of a project management database of a company, where keys are bold: E(ssn, name, salary) stores the information of employees, P(pid, title, budget) stores the information of projects, and M(ssn, pid, start, end) stores the information of management of projects by employees.

1) Write an SQL query to return the ssns of employees that manage at least two projects, one is finished (end < today), and the other is still ongoing ( start =< today =< end).

2) Write an SQL query to delete all the projects from table P that are NOT managed by any employee.

3) Define an SQL view PNum (pid, num) that gives the number of employees that manages project pid.

4) Write an SQL query to return the ssn of employees that manage each project in P.

5) Write an SQL CREATE ASSERTION statement to force the constraint An employee needs to manage at least one project

6) Write an SQL CREATE ASSERTION statement to enforce the constraint that an employee never manages two projects that overlap in time.

7) Define an SQL view Budget(ssn, totalbudget) that summarizes the total budget of projects that an employee manages.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions

Question

=+ Are ballots compulsory?

Answered: 1 week ago