Professional Documents
Culture Documents
Employee Information
Aim:
To create an employee table and retrieve records using Oracle SQL Plus.
Algorithm
Step 2: Create table named employee with the required fields using query.
Step 5: Display name of the employees whose salary is greater than “10000” using query
Step 6: Display the details of employees in ascending order according to employee code
Step 7: Display the total salary of the employees whose grade is “A” using query
Step 8: End
Result:
Thus the above program has been executed successfully and output is verified
2. Payroll System
Aim:
To create payroll table and retrieve records using Oracle SQL Plus.
Algorithm
Step 2: Create table named payroll with the required fields using query.
Step 8: Select the details of employees whose HRA >=1000 and DA<=900
Select * from payroll where hra >=1000 and da<=900;
Thus the above program has been executed successfully and output is verified
3. Product Details
Aim:
To create product table and retrieve records using Oracle SQL Plus.
Algorithm
Step 1: Click Start All Programs SQL Plus
Step 2: Create table named product with the required fields using query.
create table product(prodno number(6), pname varchar2(15), unitmeasure varchar2(15), unitprice number(4,2),
quantity number(6,2), amount number(8,2));
Step 5: Using update statements calculate the total amount and then select the record.
Update product set amount=unitprice*quantity;
Step 7: Select the records whose quantity is greater than 10 and less than or equal to 20.
select * from product where quantity > 10 and quantity <= 20;
Step 9: Calculate the number of records whose unit price is greater than 50 with count
operation.
select count(*) from product where unitprice > 50;
Result:
Thus the above program has executed successfully and output is verified.
4. Sales Order
Aim:
To create sales_order and salesorder_product table and retrieve records using Oracle SQL Plus.
Algorithm
Step 2: Create table named sales_order with the required fields using query.
Step 3: Create table named salesorder_product with the required fields using query.
Step 4: Add new column for storing salesman number using ALTER command
Alter table sales_order add salesman_no number(3);
Step 5: Set the sorder_no as foreign key as column constraints
alter table salesorder_products add foreign key(sorder_no) references sales_order(sorder_no);
Step 6: Enforce the integrity rules using CHECK
alter table sales_order add check(salesman_no >= 1 and salesman_no <=50);
Step 7: End
Result:
Thus the above program has been executed successfully and output is verified.
5. Student Information Using PL/SQL
Aim:
To create student table in SQL and to find total, average and result using PL/SQL
Algorithm
Step 2: Create table named student with the required fields using query.
Step 4: In PL/SQL, write the code to find total , average and result of student and also update the
student table.
Step 6: End
Result:
Thus the above program have been executed successfully and output is verified
6. Electricity Bill
Aim:
Algorithm
Step 2: Declare the variables consumer no,name,previous reading, current reading, number of unit and
amount
Step 3: Get the values of consumer no,name , previous reading and current reading
Step 4: Calculate the number of unit consumed = current reading – previous reading
Step 7: End
Result:
Thus the above program have been executed successfully and output is verified
7. Splitting Table
Aim:
To split the student information table into two, one with the passes and other with the failed.
Algorithm
Step 2: Create table named student with the required fields using query.
Step 4: Create table named studentpass with the required fields using query.
Step 8 : Write the code to find total and result of current student and update the student table.
Step 9: if result=’pass’ then insert the corresponding record in studentpass table. Otherwise insert the
corresponding record in studentfail table.
Result:
Thus the above program have been executed successfully and output is verified
8. Joining Table
Aim:
To join two tables: First table contains rollno,name and total mark and Second table contains the rollno
and address
Algorithm
Step 2: Create table named studentmark with the required fields rollno as primary key,name and total
mark.
Step 8: Retrieve each record from cursor using For Loop and insert records in studentdetail table
Result:
Thus the above program have been executed successfully and output is verified
9 (a). Factorial Using Recursion
Aim:
Algorithm
Step 4: Create another PL/SQL block factorial to call the function fact.
Result:
Thus the above program have been executed successfully and output is verified
9 (b). Fibonacci Series Using Recursion
Aim:
Algorithm
Step 2: Create function fibo to find Fibonacci value using recursive calls
Step 4: Create another PL/SQL block fibonacci to call the function fibo.
Result:
Thus the above program have been executed successfully and output is verified