0% found this document useful (0 votes)
22 views7 pages

ADBMS-Paper 1 - Answers

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views7 pages

ADBMS-Paper 1 - Answers

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

QUESTION 01

i) The process of making a superclass from a group of subclasses is called generalization.

- Let’s assume that you have a three classes called TECHNICIAN, JANITOR, MANAGER.
Three of them are employees inside the company. So we can make a super class out of
them as an EMPLOYEE. That’s called Generalization.

The process of making subclasses from a general concept is called specialization.

- Specialization is kinda opposite of generalization. Lets assume you have a class called
EMPLOYEE and there are different types of employees in your organization. Then you
can create sub classes using the EMPLOYEE parent class. That’s called specialization.

ii)
iii)
QUESTION 03

1)

• Normalization helps in reducing data redundancy by organizing data in a way that avoids storing
the same information in multiple places.
• Organize data in a relational database efficiently.
• Normalization helps prevent anomalies, such as update anomalies, where updating data in one
place may lead to inconsistencies if the same data is stored elsewhere in the database.
• By breaking down large tables into smaller, related tables, normalization helps maintain data
integrity by enforcing relationships between tables through foreign key constraints.
• Well-normalized databases often lead to improved query performance because data is stored
more efficiently, and relationships are well-defined.

2)

Functional dependencies (FDs) describe the relationship between two sets of attributes in a relational
database. If a functional dependency exists between two sets of attributes, it means that knowing the
values of one set uniquely determines the values of the other set.

Lets assume a relation with attributes A and B. If, for every value of A, there is only one corresponding
value of B, we can say that B is functionally dependent on A and write it as A → B.

3)
Fully Functional Dependencies (FFD):

In a relational database, an attribute A is fully functionally dependent on another attribute B if it is


functionally dependent on B, removing any attribute from B would result in A not being functionally
dependent on the remaining attributes.

For example, consider a relation with attributes EmployeeID, ProjectID, and ProjectManager. If
ProjectManager is fully functionally dependent on both EmployeeID and ProjectID, it means that
knowing both EmployeeID and ProjectID uniquely determines ProjectManager, and removing either
attribute from the set would break this dependency.

Transitive Functional Dependencies (TFD):


A transitive functional dependency occurs when one attribute functionally depends on another through
a third attribute. In other words, if A → B and B → C, then A → C is a transitive dependency.

Lets assume there is a relation with attributes StudentID, CourseID, and ProfessorName. If
ProfessorName depends on CourseID, and CourseID depends on StudentID, then there is a transitive
functional dependency from StudentID to ProfessorName.
4) 3NF

A relation is in 3NF if it is in 2NF and no transitive dependencies exist.

BCNF

A relation is in BCNF if, for every non-trivial functional dependency, the determinant is a superkey.
QUESTION 04

-- Assuming the name of the supplier table is "Supplier_tbl"

CREATE TRIGGER trg_CheckReorder


AFTER UPDATE ON Items_in_Stock
FOR EACH ROW
BEGIN
IF NEW.Items_in_stock <= NEW.Reorder_Level THEN
INSERT INTO Purchase_tbl (Item_No, Order_Level, Supplier)
VALUES (NEW.Item_No, (SELECT Order_Level FROM Supplier_tbl WHERE SupplierID =
'SUP_001'), 'SUP_001');
END IF;
END;

……………………………………………………………….OR ………………………………………………………………..

create trigger stocktrig ON items_in_stock


after update
as
begin
if( new.items_in_stock<=new.ROL)
begin
insert into purchase_tbl values(new.item_no,(select order_level from supplier_tbl),(select
supplier_id from supplier_tbl));
end if;
end;
Question 05

i)
CREATE TRIGGER trg_CheckReorder
AFTER UPDATE ON Items_InHand
FOR EACH ROW
BEGIN
IF NEW.Items_Available <= NEW.ROL THEN
INSERT INTO Purchase_Details (Item_Code, Item_Name)
VALUES (NEW.Item_Code, NEW.Name);
END IF;
END;
……………………………………………….……………………….. OR…………………………………………………

create trigger items_inHandtrg ON items_inHand


after update
AS
BEGIN
IF(new.items_available<new.rol)
BEGIN
insert into purchase_det values(new.item_code,new.name);
END IF;
END;

ii)

Stored Procedures Functions

Return none or more values Return single value

Have input and output parameters Have only input parameters

Use Try-Catch to exception handling We cannot use Try-Catch with functions

Cannot be called from function Can be called from procedure


QUESTION 06

You might also like