Solutions 5
1.Demonstrate how you add a textbook to the database and make this book be adapted bysomedepartment.
insert into book values (1, 1,555);
Insert into text values('666','ada','tata','clen henry');
2.Produce list of textbooks (include Course#, Book-ISBN, Book-title) in the alphabeticalorder for courses offered by the CS department that use more than two books.
select c.course,b.book_isbn,t.book_title from course c ,text t,book b where c.course=b.course and
b.book_isbn=t.book_isbn and c.dept ='computer science' group by
c.course,b.book_isbn,t.book_title
order by t.book_title;
3.List any department that has its adopted books published by a specific publisher.
Select c.dept, t.publisher from course3 c,texts3 t,book b where c.course=b.course and
b.book_isbn=t.book_isbn andt.publisher=’pearson’ group by c.dept, t.publisher;
Write PL/SQL program to demonstrate user defined exception handling.
var_dividend NUMBER :=24;
var_divisor NUMBER :=0;
var_result NUMBER;
ex_divzero EXCEPTION;
BEGIN
IF var_divisor=0 THENRAISE ex_divzero;
END IF;
var_result :=var_dividend/var_divisor;
DBMS_OUTPUT.PUT_LINE('Result=' || var_result);EXCEPTION WHEN ex_divzero THEN
DBMS_OUTPUT.PUT_LINE ('ERROR YOUR DIVISOR IS ZERO');
END;
/
Comments
Post a Comment