Consider an enterprise in which di?erent projects use parts supplied by various suppliers. De?ne the appropriate tables along with the corresponding foreign-key constraints. De?ne triggers that ?re when a project changes a supplier for a part; when a supplier discontinues a part; or when a project stops using a part.

What will be an ideal response?


```
CREATE TABLE Contract (
PartId INTEGER,
SupplierId INTEGER,
ProjectId INTEGER,
PRIMARY KEY (PartId, SupplierId, ProjectId),
FOREIGN KEY (PartId, SupplierId) REFERENCES Supplies
FOREIGN KEY (PartId) REFERENCES Part
FOREIGN KEY (ProjectId) REFERENCES Project
FOREIGN KEY (SupplierId) REFERENCES Supplier )
```

In addition, we have a table Supplies, which tells which supplier supplies what, and the relations Part, Project, and Supplier, which describe the corresponding entities.

```
CREATE TRIGGER ProjectChangedSupplier
BEFORE UPDATE OF SupplierId ON Contract
REFERENCING NEW AS N
FOR EACH ROW
INSERT INTO Log
VALUES (CURRENT_DATE, ’Supplier Change’, ProjectId,
PartId, SupplierId, N.SupplierId)
```

```
CREATE TRIGGER SupplierDiscontinuedPart
AFTER DELETE ON Supplies
REFERENCING OLD AS O
FOR EACH ROW
UPDATE Contract
SET SupplierId = NULL
WHERE PartId = O.PartId AND SupplierId=O.SupplierId
```

```
CREATE TRIGGER ProjectStoppedUsingPart
AFTER DELETE ON Contract
REFERENCING OLD AS O
FOR EACH ROW
WHEN (NOT EXISTS (
SELECT *
FROM Contract C
WHERE C.PartId = O.PartId ))
INSERT INTO Log
VALUES (CURRENT_DATE, ’Stopped part use’, ProjectId,
PartId, NULL, O.SupplierId)
```

Computer Science & Information Technology

You might also like to view...

Create a class SchoolKid that is the base class for children at a school. It should have attributes for the child’s name and age, the name of the child’s teacher, and a greeting. It should have appropriate accessor and mutator methods for each of the attributes.

What will be an ideal response?

Computer Science & Information Technology

Case A-1Tayler Rae is the new web master for her sorority at Northern University. She is responsible for the content and design of its web pages. Tayler plans to incorporate many elements including text, images, sound, and movies. Tayler wants to use content containers that float over any page elements, because they are easy to reposition. What element(s) could she use?

A. Tables B. Divs C. AP Divs D. Both b and c

Computer Science & Information Technology

By creating consistent properties (like those in the accompanying figure) for files having similar content, users can better organize their documents.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The AccessData program has a hashing database, ________________, which is available only with FTK, and can be used to filter known program files from view and contains the hash values of known illegal files.?

A. ?DeepScan Filter  B. Unknown File Filter (UFF) C. ?Known File Filter (KFF) D. ?FTK Hash Imager

Computer Science & Information Technology