Documente Academic
Documente Profesional
Documente Cultură
Ans:
The relation schema R is {Qi1, Qi2 , ...,Qin}
and the primary key of relation schema S is {Yi1, Yi2 , ...,Yim}. Then a
relationship
between the 2 sets can be represented as a tuple (Qi1, Qi2 , ...,QinYi1, Yi2
, ...,Yim). In a one-to-one relationship, each value on {Qi1, Qi2 , ...,Qin}will
appear in exactly one tuple and likewise for {Yi1, Yi2 , ...,Yim}. In amanyto-
one relationship (e.g., many A - one B), each value on {Qi1, Qi2 , ...,Qin} will
appear once, and each value on {Yi1, Yi2 , ...,Yin} may appear many times.
In a
many-to-many relationship, values on both {Qi1, Qi2 , ...,Qin} and { Yi1, Yi2
, ...,Yim} will appearmany times.
Ans : There are times when duplicate records somehow creep into a table
despite your best efforts. This happens more in cases where data is loaded
into table from other sources because during data loads, the integrity
constraints are disabled.
The following SQL statement helps in deleting the duplicate rows in a table:
delete table_a
where rowid not in
(select min(rowid) from table_a
group by column1, column2);
BEGIN
IF INSERTING THEN
INSERT INTO AUDITOR VALUES(:NEW.EMPNO,'INSERT');
ELSIF UPDATING THEN
INSERT INTO AUDITOR VALUES(:NEW.EMPNO,'UPDATE');
ELSIF DELETING THEN
INSERT INTO AUDITOR VALUES(:OLD.EMPNO,'DELETE');
ENDIF;
Part-B
(a)Ans:Create View Bank As Select account number, customer name from
accounts where branchname=’Deer Park Branch
(b. )
UPDATE VW_PRODUCT
SET VALUE = ‘GREEN’
WHERE PRODUCT_ID = 2
AND ATTRIBUTE = ‘COLOR’;