Professional Documents
Culture Documents
Faculty of MCA
CERTIFICATE
Place:
Date:
Name: Tejas Arun Gaikwad Date: 24-8-2023
Subject: RDBMS
Experiment No.1
Theory:
Query:
Output:
Faculty Of MCA
Program: Insert data into the table
Query:
insert into organization values(1, 'Akshay Patil', 'Mayni', 55000, 'MCA', 8784545748, 'Satara', 'Production',
'Production Supervisor', 'oragnic farming');
insert into organization values(2, 'Sourabh Wankar', 'Raviwar Peth', 55000, 'MCA', 9877588955, 'Satara',
'Production', 'Production manager', 'Yuva Nete Yojna');
insert into organization values(3, 'Sejal Randive', 'Raviwar Peth', 55000, 'MCA', 6699885535, 'Satara',
'Finance', 'Fianace Manager', 'footware System');
insert into organization values(4, 'Chetan Sutar', 'Swaroop Colony', 55000, 'MCA', 938355745, 'Satara', 'Sales',
'Sales manger', 'Furniture Manufacturing System');
insert into organization values(5, 'Neeraj Bhagat', 'Khalcha Rashta', 55000, 'MCA', 5456756477, 'Satara',
'Marketing', 'marketing manager', 'Hospital System');
insert into organization values(6, 'Nikhil shinde', 'Umbraj', 45000, 'MCA', 9566545445, 'Satara', 'Technical',
'Technical manager', 'Food Management System');
insert into organization values(7, 'Rohan salunkhe', 'Nagthane', 35000, 'MBA', 5679674711, 'Satara',
'Transportation', 'Transportation Manager', 'data encryption system');
insert into organization values(8, 'Kaustubh Dhone', 'Sahupuri', 45000, 'MBA', 9966558833, 'Satara', 'finance',
'cashier', 'web browser');
insert into organization values(9, 'Siddhart Bhange', 'Saniwar peth', 25000, 'MCA', 9566889944, 'Satara',
'Inventry', 'Inventry manager', 'Nursury System');
insert into organization values(10, 'Umair', 'Karanje', 25000, 'BCA', 9566544545, 'Satara', 'Miantenance',
'Miantenance manager', 'Vehicle Renting System');
Output:
Faculty Of MCA
Program: View data from the table
Query:
Output:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:25-8-2023
Subject: RDBMS
Experiment No.2
Theory:
Query:
Output:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:30-8-2023
Subject: RDBMS
Experiment No.3
Theory:
Query:
Output:
Faculty Of MCA
Program: Program: Sort Emp_name column in ascending order.
Query:
Output:
Query:
Output:
Faculty Of MCA
Program: Sort Emp_id column in descending order.
Query:
Output:
Query:
Output:
Faculty Of MCA
Program: Sort Emp_name column in descending order.
Query:
Output:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:31-8-2023
Subject: RDBMS
Experiment No.4
Theory:
Query:
Output:
Faculty Of MCA
Program: Update Emp_qualification column
Query:
Output:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:1-9-2023
Subject :RDBMS
Experimemt No-5
Insert :
INSERT INTO Stud4
(5,'kunal ahire','beed',7807558675,'ba');VALUES
Output:
Update:
Output:
Output:
Delete:
Output:
Std_id=5;
Output:
Name: Tejas Arun Gaikwad Date:4-9-2023
Subject :RDBMS
Experimemt No-6
Output:
Output:
Modify Column:
Alter table Stud4 Modify Std_Category varchar(10);
Output:
Drop Column:
Alter table Stud4 Drop column Std_Category;
Output:
Name: Tejas Arun Gaikwad Date:6-9-2023
Subject :RDBMS
Experimemt No-7
Output:
Output:
Name: Tejas Arun Gaikwad Date:7-9-2023
Experiment No-8
PRIMARY KEY:
create table Supplier12
Product_name varchar(20),
Product_Price int,
Product_Quantity int
);
Output:
FOREIGN KEY:
create table Order12
Order_name varchar(20),
Order_Price int,
);
Output:
Name: Tejas Arun Gaikwad Date: 8-9-2023
Experiment No-9
Q9. Study of view and indexes in database.
Creating Views:
create view Supplier12_view as select product_name,product_price from Supplier12;
Output:
Updating Views:
update Supplier12_view set product_price=1500 where product_name='Grapes';
Output:
Deleting views:
Example:
delete from Supplier12_view where product_price=1500;
Output:
INDEXES IN DATABASE:
Creating index-
create index Supplier12_index on Supplier12(Supplier_id,Product_name);
Output:
Single-Column index-
create index Supplier12_index on Supplier12(Product_name);
Output:
Unique Index-
create unique index Supplier_index1 on Supplier12(Product_name);
Output:
Composite Index-
create index Supplier_index on Supplier12(Supplier_id,Product_name);
Output:
Dropping index-
drop index Supplier_index ;
Output:
Name: Tejas Arun Gaikwad Date:11-9-2023
Subject: RDBMS
Experiment No: 10
Theory:
Program:
DECLARE
a Number:=10;
BEGIN
END IF;
END;
Output:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:13-9-2023
Subject: RDBMS
Experiment No: 11
Program:
declare
a number:=20;
b number:=10;
c number;
d number;
e float;
f number;
begin
c:=a+b;
d:=a-b;
e:=a/b;
f:=a*b;
Faculty Of MCA
end;
Output:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date: 14-9-2023
Subject: RDBMS
Experiment No: 12
Theory:
Program:
DECLARE
num NUMBER(3) := 2;
sum1 NUMBER(4) := 0;
BEGIN
WHILE num <= 11 LOOP
dbms_output.Put_line(num);
sum1 := sum1 + num;
num := num + 2;
END LOOP;
dbms_output.Put_line('Sum of even numbers is ' || sum1);
END;
Faculty Of MCA
Output:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:05-9-2023
Subject: RDBMS
Experiment No: 13
Title: Write a program that uses datatype of sal from table.(%type attribute).
Theory:
Program:
Output:
declare
salary gaurav157.sal%type;
begin
end;
Faculty Of MCA
select*from gaurav157;
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:29-9-2023
Subject: RDBMS
Experiment No: 14
Title: Write a program to insert employee code into employee table.(%rowtype attribute)
Theory:
Program:
declare
emp gaurav157%Rowtype;
begin
emp.eno:=3;
emp.ename:='gaurav';
emp.sal:=3000;
end;
Output:
Faculty Of MCA
select*from gaurav157
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:4-10-2023
Subject: RDBMS
Experiment No: 15
Theory:
Program:
DECLARE
n NUMBER := 2935;
r NUMBER;
BEGIN
r := MOD(n, 2);
IF r = 0 THEN
dbms_output.Put_line('Even');
ELSE
dbms_output.Put_line('Odd');
END IF;
END;
Faculty Of MCA
Output:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date: 5-10-2023
class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No.16
Aim : WAP to find grades of a student.
Theory :
Program :
declare
grd CHAR(1);
begin
grd:= ‘A’;
case grd
when ‘A’ then dbms_output. Put_line (‘Your Grade is: Outstanding’);
when ‘B’ then dbms_output.Put_line(‘Your Grade is: Excellent’);
when ‘C’ then dbms_output. Put_line (‘Your Grade is: Very Good’);
when ‘D’ then dbms_output. Put_line (‘Your Grade is: Average’);
when ‘F’ then dbms_output. Put_line( ‘Your Grade is: Poor’);
else dbms_output. Put_line (‘No such grade in the list.’);
end case;
end;
Output :
Conclusion :
Faculty Of MCA
.
Experiment No.17
Aim : WAP a PL/SQL code to find greater number among three numbers.
Theory :
Program :
declare
a number := 50;
b number := 78;
c number := 75;
begin
if a b and a > c
then
dbms_output.Put_line (‘Greatest number is ’||a);
elsif b> a and b > c
then
dbms_output.Put_line(‘Greatest number is ’||b);
else
dbms_output. Put_line(‘Greatest number is ’||c);
end if;
end;
Output:
Conclusion :
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:9-10-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No.18
Aim: Write a PL/SQL code to remove problem in program 10.
Theory:
Program:
Declare
a number;
b number;
e number;
begin
b:=:b;
c:=-a/b;
dbms_output.put_line (‘C is:’ || c);
exception when zero_divide
then
dbms_output.put_line (‘division of any number by zero will raise a problem, verify input values.’)
end;
Output:-
Conclusion :-
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:11-10-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No.19
Aim: Write a PL/SQL code which handles more than one exception.
Theory:
Program:
Declare
Name Employee1. Emp_Name%type;
begin
select Emp_Name into Name From Employee1 where Dept _No=60;
dbms_output.put_line (‘Employee name is: ’||Name);
exception
when zero_divide
then
dbms_output.put_line (‘Not Possible!’);
when too_many_rows then
dbms_output.put_line (‘More than 1 row is returned.’);
when others then
dbms_output.put_line (‘No data found.’);
end;
Output:
Conclusion:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:12-10-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No.20
Aim: Write a PL/SQL code which explains the usage of NO_DATA_FOUND exception.
Theory:
Program:
Declare
EName Employee1. Emp_Name%TYPE;
Emp_id1 Employeel. Emp_No%TYPE:=:Emp_No;
begin
SELECT Emp_Name INTO EName FROM Employee1
WHERE Emp No Emp_id1;
--show the customer name
dbms_output.put_line (‘Employee name is ’ || EName);
EXCEPTION
WHEN NO _DATA_ FOUND THEN
dbms_output.put_line (‘Employee’ || Emp_id1 || ‘does not exist ’|| ‘NO Data Found’);
end;
Output:
Conclusion :-
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:13-10-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No.21
Aim: Write a PL/SQL code that uses implicit cursor attributes Inthis program update
salary of employees, if the salary is notupdated then display message for that.
Theory:
Program:
declare
rows number (5);
begin
update Employee set Emp_Salary= Emp_Salary+1000;
if SQL%NOTFOUND
then
dbms_output.put_line(‘none of the salaries were updated’);
elsif SQL%FOUND
then
rows:= SQLXROWCOUNT;
dbms_output.put_line(‘salaries of ’ ||rows||‘ employee are updated’);
end if;
end;
Output:
Conclusion:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:16-10-23
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No. 22
Aim: write a pl/sql code that returns the total no. of rows that are updated using
ROW COUNT attribute.
Theory:
Program:
Declare
begin
update Employee1 set Emp_Salary= Emp_Salary*2 where Emp_No=3; dbms_output.put_line (‘record updated=
’|| SQL %ROWCOUNT);
end;
Output:
Conclusion:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:18-10-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No. 23
Aim: Write a PL/SQL code to delete a record from table, if delete operation
succeeds the insert operation.
Theory:
Declare
begin
delete from Employeel where Emp No :Emp_No;
if SQL%FOUND
then
dbms_output.put_line('Record found & deleted'); |
insert into Employeel values('Saurabh', 80, 15000,8);
else dbms_output.put_line('record not found');
end if;
end;
Output:
Conclusion:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:20-10-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No. 24
Aim: Create a user defined exception which checks the name of the employee is
bank during the insertion.If you left the name blank it will raise error.
Theory:
Program:
declare eno employeel. Emp_No%type;
name employeel.Emp_Name%Stype;
name exception exception;
begin
eno:=:eno;
name:=:name;
if name is null then raise name exception;
end if;
insert into employeel (Emp No, Emp Name) values (eno, name); dbms_output.put_line('Data entered into the
row.");
exception when name_ exception then
dbms_output.put_line('ename should not be empty.");
end;
Output:
Conclusion :-
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:26-10-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No. 25
Aim: Write a PL/SQL code to display the information of the employee table with
%NOTFOUND attribute.
Theory:
Program:
declare
eid employeel. Emp_No%type;
name employeel. Emp_Name% type;
salary employeel.Emp_Salary %type;
cursor cursor1 is select Emp No, Emp Name, Emp Salary from employee1;
begin
open cursor1;
loop
fetch cursor1 into eid, name, salary;
exit when cursor1%NOTFOUND;
dbms_output.put_line (‘emp_id =’ ||eid||‘ ’||‘emp_name’ || name|| ‘ ’ ||‘emp_salary=’ || salary);
end loop;
close cursor1;
end;
Output:
Conclusion:
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:05-10-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No. 26
Program:
declare
cursor cursor2 is select Emp_No, Emp_Name, Emp_Salary from employeel where Dept_No= : Dept_No;
name employeel Emp Name type; eid empl. Emp_No%type;
salary employeel. Emp_Salary%type;
begin
open cursor2;
fetch cursory into name,eid, salary; exit when cursor2%NOTFOUND;
dbms_output.put_line(‘emp_id= ’||eid||‘ ’||‘emp_name=’||‘ ’ ||name||‘ ’||‘emp_salary=’||salary);
end loop;
close cursor2;
end;
Output:
Conclusion :-
Faculty Of MCA
Name: Tejas Arun Gaikwad Class: MCA-1
ROLL NO: 05 Date: 6-11-2023
Subject: RDBMS
Experiment No. 05
Aim :- Write a PL/SQL code to increase the salary of the employees if the post is of‘clerk’, his or her
salary will be doubled and if the post is of ‘salesman’ he or she will get the increment of 5%.
Theory:-
Program:-
Output :-
Faculty Of MCA
Name: Tejas Arun Gaikwad Date:8-11-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No. 28
Aim :- Write a PL/SQL code to find out the salary of an employeeif salary is less than
18000 of employee no.7, then add RS 1000 to the original salary of that employee.
Theory :-
Program :-
DECLARE
Salary NUMBER;
BEGIN
SELECT EMP_ Salary INTO Salary FROM Employee1 WHERE Emp_No=1;
IF
Salary<18500
THEN
GOTO tanuja:
ELSE
DBMS_OUTPUT.PUT_LINE(‘SALARY IS’ ||Salary);
END IF;
<<tanuja>>
UPDATE Employee1 SET Emp_Salary=Emp Salary+1000 WHERE Emp_No=1;|
END;
/
Output :-
Conclusion :-
Faculty Of MCA
Name: Tejas Arun Gaikwad Date: 20-11-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No. 29
Program :-
Declare
N number;
I number:=1;
FACT NUMBER:=1;
BEGIN
N:=:N;
WHILE I<N LOOP
FACT:= FACT *I;
DBMS_OUTPUT.PUT_LINE(‘FACTORIAL IS=’ ||FACT);
END LOOP;
END;
Output :-
Faculty Of MCA
Name: Tejas Arun Gaikwad Date: 22-11-2023
Class: MCA-1 ROLL NO: 05
Subject: RDBMS
Experiment No. 30
Aim :- Write a PL/SQL code to perform arithmetic operations on some data.
Theory :-
Program :-
DECLARE
A NUMBER;
B NUMBER;
C NUMBER;
D NUMBER;
BEGIN
A:=:A
IF D=1
THEN
C:=A+B;
ELSIF
D=2
THEN
C:=A-B
ELSIF
D=3
THEN
C:=A*B
ELSIF
D=4
THEN
C:=A/B
DBMS_OUTPUT.PUT_LINE(‘ENTER VALID NUMBER’);
END IF;
DBMS_OUTPUT.PUT_LINE(‘C|| IS THE RESULT’);
END:
Faculty Of MCA
Output :-
Conclusion :-
Faculty Of MCA