List of Experiments/Excercises
List of Experiments/Excercises
List of Experiments/Excercises
1. Create a Ta
Year) and insert minimum 10 records in this Student_records Table with Primary Key
(Student_RollNo).
Student_RollNo char(10),
Student_Name char(20),
FatherName char(20),
Branch char(10),
section char(10),
Year char(10),
primary key(Student_RollNo)
);
b. Find the Items which have Price between 1000 and 5000.
/* sql query */
/*b*/ SELECT Item_name FROM ITEM WHERE Item_price BETWEEN 1000 AND 5000;
Select * from ITEM ;
101 MCA AA
102 MBA CC
103 B.Tech BB
105 B.Arch FF
106 BCA GG
/*a*/
Update Department_Information set Department_Location = 'MM' where Department_Name =
'B.Pharma' ;
/*c*/
Alter table Department_Information Add Department_phoneNo Numeric(10);
/*d*/
Alter table Department_Information add Department_Address char(20);
/*e*/
Alter Table Department_Information drop Department_Location;
Select * from Department_Information;
(Emp_id,Emp_Name,Emp_Salary,Emp_Designation)
c. Find the name of employee which has salary more than 10000.
--(a)
select emp_name from employee_info where emp_salary in
(select min(emp_salary) from employee_info);
--(b)
select emp_name from employee_info where emp_salary in
(select max(emp_salary) from employee_info);
--(c)
select emp_name from employee_info where emp_salary > 10000;
--(d)
select emp_name from employee_info where emp_salary > 25000;
--(e)
select emp_id,sum(emp_salary) as 'total salary' from employee_info
--UPDATE:
Update Student_Records set FatherName ='Mahendra ' where Student_RollNo = 05;
Select * from Student_Records;
--Drop:
Alter Student_Records drop section;
primary key(ID )
);
DECLARE
total_rows number(2);
BEGIN
UPDATE Employee
SET salary = salary + 2000;
IF sql%notfound THEN
dbms_output.put_line('no Employee updated');
ELSIF sql%found THEN
total_rows := sql%rowcount;
dbms_output.put_line( total_rows || ' Employee updated ');
END IF;
END;
/
Begin
I:=1;
While (I<=10)
Loop
Dbms_output.put_line(I);
I:=I+1;
End loop;
End;
declare
-- declare variable n, i
n number;
i number;
temp number;
begin
n := 13;
-- Assigning 2 to i
i := 2;
temp := 1;
for i in 2..n/2
loop
if mod(n, i) = 0
then
temp := 0;
exit;
end if;
end loop;
if temp = 1
then
dbms_output.put_line('true');
else
dbms_output.put_line('false');
end if;
end;
-- Program End
a number;
x := x * x;
END;
BEGIN
a:= 2;
squareNum(a);
END;
UPDATE Employee
SET salary = salary + 500
WHERE id = 2;
Select * from Employee;