0% found this document useful (0 votes)
29 views4 pages

DBMS Exam All Answer

The document contains SQL statements to create tables for actors and directors, insert sample data, and write queries to join and filter the tables. It also contains PL/SQL blocks to check if a number is odd or even, and print a triangular pattern of numbers.

Uploaded by

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

DBMS Exam All Answer

The document contains SQL statements to create tables for actors and directors, insert sample data, and write queries to join and filter the tables. It also contains PL/SQL blocks to check if a number is odd or even, and print a triangular pattern of numbers.

Uploaded by

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

1)

create table Actor(Actorid number(5),Actorname varchar2(5),Age number(3));

insert into Actor values(1,'Abc',34);

insert into Actor values(2,'Mno',35);

insert into Actor values(3,'Xyz',25);

insert into Actor values(4,'Ijk',26);

insert into Actor values(5,'Pqr',27);

select *from Actor;

create table Director(Directorid number(5),Directorname varchar2(5),DOB date);

insert into Director values(101,'Abc','01-oct-1980');

insert into Director values(102,'Raj','11-jun-1983');

insert into Director values(103,'Xyz','05-jan-1980');

insert into Director values(104,'Maya','21-nov-1983');

insert into Director values(105,'John','05-dec-1985');

select *from Director;


(1) select *from Actor, Director where
Actor.Actorname=Director.Directorname;

(2) SELECT * FROM Actor

WHERE NOT EXISTS

(SELECT *

FROM Director

WHERE Actor.Actorname = Director.Directorname);

(3) SELECT * FROM Director

WHERE NOT EXISTS

(SELECT *

FROM Actor

WHERE Actor.Actorname = Director.Directorname);

(2)(a) odd Even

declare

n number:= :n;

begin

if mod(n,2)=0

then
dbms_output.put_line('number is even');

else

dbms_output.put_line('number is odd');

end if;

end;

(2)(b)print pattern

declare

n number:= :n;

i number(5);

j number(5);

begin

for i in 1..n

loop

for j in 1..i

loop

dbms_output.put(i);

end loop;

dbms_output.new_line;

end loop;

end;

You might also like