Practical Exam Reference Question
Practical Exam Reference Question
1. Create and Execute DDL Command for student table 1) Create 2) Alter 3) Rename 4)
Drop 5) Truncate 6) Describe
Consider following schema student (stud_id, name, class, city, percentage)
2. Create a table employee and department with following schema by applying primary key
and foreign key:
Emp(empno as primary key, empname, salary, phno)
Dept(deptno as primary key, empno as foreign key, deptname, location)
11.Create a trigger to set the salary for a new employee in the "Emp" table before insertion
the salary should be greater than 30000.
13.Write PL/SQL program to accept three number and display the largest number
15.Write PL/SQL program to display 1 to 10 numbers in reverse order using for loop
16. Write PL/SQL program to find factorial of number 5 using while loop
19.Write a PL/SQL program to check whether a given number is positive, negative or zero.
21.Create Two Tables Emp and Dept, Consider the following schema
Emp (Emp_no as primary key, E_name, Dept_no, Dept_name, name, Job_id, Salary)
Dept (Dept_no as primary key, emp_no foreign key, deptname, location)
1. Display the information of the tables using the SELECT command.
2. Execute the SQL queries using SELECT, WHERE, GROUP BY clause.
3. Execute the SQL queries using SELECT, WHERE, GROUP BY and HAVING clause.
4. Execute the SQL queries using SELECT, WHERE, ORDER BY clause.
24.Write a PL/SQL program that checks if a given number is positive, and if it is, prints
"Number is positive".
25.Write a PL/SQL program that asks the user for their age and then prints “You can vote" if
they are over 18, and "You cannot vote" otherwise.
26.Write a PL/SQL program that asks the user for percentage and then assigns grades based
on the following conditions:
Distinction (>=75%)
First Class (>=60 and <75)
Second Class (>=45 and <60)
Pass Class (>=40 and <45)
Fail (<40)
30.. Write a PL/SQL program that asks the user to input two numbers and divide the first
number by the second. Handle the predefined exception for division by zero and display an
appropriate message if it occurs.
31.Create a stored procedure to accept names and greet users with names.
32.Write PL/SQL function which will compute and return the maximum of two values.
34.Create a trigger on the EMP table which is invoked when salary is below 5000 .