You are on page 1of 10

1. STUDENT DETAILS USING SQL.

AIM:
To create a table for student details and performing various queries using comparison
logical, set, sorting and grouping operators

ALGORITHM:
Step 1: Start the process.
Step 2: Create a table named Student with the fields regno, first name, last name, course_
name, gender, age, year of joining and percentage with regno as its primary key.
Step 3: Insert the values for 10 records in the table.
Step 4: Perform the query using any one of the comparison operators such as <, >,<=,
>=,=&,!=.
Step 5: Perform the query using any one of the logical operators AND,OR, NOT.
Step 6: Perform the query using any one of the set operators UNION, UNION ALL,
INTERSECT and MINUS
Step 7: Perform the query using order by clause to sort the record in a table.
Step 8: Perform a Query using group by clause.
Step 9: Display the result.
Step 10: Stop the process.
2. DDL AND DML COMANDS.
AIM:
To create a table for student database and performing DDL and DML commands.
ALGORITHM:
Step 1: Start the process.
Step 2: Create a table for student database with the fields studentid as its primary key,
studentname, department and marks for two subjects.
Step 3: Add and modify the columns by using the alter statement.
Step 4: Change the table name using rename command.
Step 5: Insert the values into a student table and display the records using insert and select
statements respectively.
Step 6: Update the field values using update statement.
Step 7: Delete the record based on the condition using delete statement.
Step 8: Stop the process.
3. CORPORATE MANAGEMENT SYSTEM

AIM
To create a table for employee payslip and design a data report using a column format
ALGORITHM
Step 1: Start the process
Step 2: Create a table master with the fields empid as its primary key, designation, date of
join, date of birth and gender.
Step 3: Create a table transaction with the fields empid, which refer the empid in the master
table, emp name, deptname, exp & salary.
Step 4: Insert the values for 5 records in the master table.
Step 5: Insert the value for 5 records in the transaction table.
Step 6: Display the top title and bottom title at the centre of the report.
Step 7: Display the fields from both the tables by using tables aliases.
Step 8: Stop the program.
4. QUERIES USING BUILT IN FUNCTIONS.
AIM:
To write queries using built in functions.
ALGORITHM:
Step 1: Start the process
Step 2: The functions ADD_MONTHS add LAST_DAY are used to add the calendar months
to a date and to return the last day of the month
Step 3: ROUND function is used to round the values and TRUNC function is used to truncate
the value
Step 4: The character function INITCAP is used to convert the first character of the word to
uppercase.
Step 5: The functions UPPER and LOWER converts each letter to uppercase and lower case
respectively
Step 6: The function LTRIM removes the leading supplied characters and RTRIM removes
the trailing supplied characters.
Step 7: The REPLACE function replaces the substring by the given string.
Step 8: The function LPAD pads the value with the string to the left to a total width of n and
the function RPAD pads the value with the string to the right to a total width of n
Step 9: The ABS function returns the absolute value of a column.
Step 10: The CEIL function returns the next higher integer value and the MOD function
Finds the integer remainder of X/Y.
Step 11: The POWER function returns n raised to POWER p and ROUND function
rounds the column or expressions.
Step 12: The TRUNC function truncates the column or expressions and the SQRT function
find the square root of the number
Step 13: The conversion functions are used to convert the date into a given format.
Step 14: The AVG function finds out the Average value, the MIN function finds out the
Minimum value, the MAX function finds out the Maximum value and the SUM
functions finds out the total value.
Step 15: Display the result.
Step 16: Stop the process.
5. LEAP YEAR USING PL/SQL.

AIM:
To write PL/SQL block to check whether the given year is a leap year or not.
ALGORITHM:
Step1: Start the process.
Step2: Declare the variables.
Step3: Read the year from the user.
Step4: Check whether the given year is divisible by four but not by 100, or it is divisible by
400.
Step5: Display the leap year.
Step6: Stop the process.
6. FACTORIAL USING RECURSIVE FUNCTION.
AIM:
To write a PL/SQL code to find factorial of a given number using recursive function.
ALGORITHM:
Step1: Start the process.
Step2: Accept the value of n in the function FACT through parameters.
Step3: If n=1, return 1 otherwise return n*fact (n-1).
Step4: Get the value of n, factorial to be found.
Step5: Call the function FACT parameters.
Step6: Display the factorial of the given number.
Step7: Stop the process.
7.PL/SQL PROGRAM IN CURSORS USING LOOP.

AIM:
To write a PL/SQL program in cursor using loops.
ALGORITHM:
Step1: Start the process.
Step2: Create a table emp with the fields empid, empname and salary.
Step3 : Insert the values for 5 records.
Step4: Declare a cursor by defining the SQL statement that result the set.
Step5: Open the cursor and fetch the rows from the cursor one by one to perform data
manipulation.
Step6: Display the result and close the cursor explicitly.
Step7: Stop the process.
8. EMPLOYEE TABLE USING BEFORE TRIGGER AND EXCEPTION HANDLING

AIM:
To write a trigger on employee table and check whether the day is Sunday (or) not and
allow the DML Statement execution of it is not Sunday.
ALGORITHM:
Step1: Start the process.
Step2: Create the employee table with the fields emp id as its primary key, emp name, emp
desig, gender, empdoj & empSalary.
Step3: Create a trigger before performing DML Statements on employee table.
Step4: Declare the exceptions.
Step5: Check whether the sysdate is Sunday or not.
Step6: If it is Sunday, do not allow DML Statement and if not Sunday, allow DML
Statement on employee table.
Step7: Stop the process.
9. INVENTORY MANAGEMENT SYSTEM USING TRIGGER

AIM:
To create a database trigger to implement in the main and transaction tables for checking
the data validity

ALGORITHM:
Step 1: Start the process
Step 2: Create a master table with the fields itemno,as its primary key,itemname and
Itemprice.
Step3 : Insert value for three records
Step4 : Create a transaction table with the fields itemno which refers to the itemno of master
table,itempurchase date,item sales date and customer name.
Step 5: Write the trigger before inserting the values for the records into the transaction table
to check the vaidity of the item.
Step 5: Insert the values for the records into the transaction table and the validity is checked.
Step 6: Stop the process
10.BANK ACCOUNT MANAGEMENT USING EXCEPTION HANDLING

AIM:
To write a PL/SQL program to create a table for a bank account and create an exception
for managing the account.
ALGORITHM:
Step1 : Start the process.
Step 2: Create a table banktransaction with the fields customer no as its primary key,
customername, bankname, bankbranch, accountopendate and typeoftheacoount.
Step 3: Insert the values in the banktransaction table.
Step 4: Create a table bankdaily with the fields customer no which refers the
customerno of banktransaction table, dateoftransaction and depositamount.
Step 4: Create a trigger on bankdaily to check the deposit amount is less than or equal to zero
Step 5: Insert the values into values into bankdaily and deposit amount is checked.
Step 6: Stop the process.

You might also like