0% found this document useful (0 votes)
39 views4 pages

Practical Exam Reference Question

Uploaded by

imtiyaz36546
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views4 pages

Practical Exam Reference Question

Uploaded by

imtiyaz36546
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

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)

3. Create and execute DML commands 1) Insert 2) Update 3) Delete


Consider following schema Emp( empno, emp_name, salary, dept_name, hire_date)
1) Insert Multiple rows at least 5 rows
2) Delete from emp where emp_name = ‘Sam’
3) Update salary salary of employee whose empno = 3;

4. Create a table EMPLOYEE with following Schema:


Emp( emp_no, emp_name, dept_no, dept_name, job_id, salary, hiredate)
Write SQL Queries for the following
1) Insert at least 5 rows in the table
2) Display all the information of EMP table
3) Delete the employee working in the SALES department and having salary below 10000
4) Find employees whose names start with the letter 'S' in the "Emp" table.

5. Create a table EMPLOYEE with following Schema:


Emp( emp_no, emp_name, dept_no, dept_name, job_id, salary, hiredate)
Write SQL queries for the following:
1) Display information of employee whose salary is greater than average salary of all
employee
2) Select maximum and minimum salary from emp table
3) Select count of emp_name from employee table where dept_name = sales
4) Select sum of salary from employee table

6. Write output of Following string function


1) Lower 2) upper 3) Length 4) Substr 5) Concat

7. Write output on following Numeric function


1) Abs 2) Ceiling 3) Floor 4) Exp 5) Power 6) Sqrt
8. Consider following schema dept( dept_no, dept_name, location)
Write output on following queries:
1) Create dept_view on dept table
2) Insert new record in dept_view
3) Delete the record of the dept_no 10 from dept_view
4) Delete the view dept_view

9. Write SQL Commands for following statements.


i. Create user Jack having password as‘Jack123’
ii. Assign insert and update privileges to user Jack on the student table.
iii. Remove update privileges from ‘Jack’.
iv. Assign the SELECT privilege on student table to Jack

10.Write SQL Commands to perform following operations on Sequence.


i. Create a sequence with following specifications.
Name: DB_SEQ
Starting Value: 1
Maximum Value: 10
Increment By: 2
ii. Insert records into any table using sequence DB_SEQ
iii. Modify a sequence named DB_SEQ with following specifications.
Increment By: 3
Maximum Value: 20
iv. Remove a sequence DB_SEQ from database

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.

12.Write a PL/SQL program to add two numbers entered by the user.

13.Write PL/SQL program to accept three number and display the largest number

14.Write PL/SQL program to display even numbers between 1 to 100

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

17.Write a PL/SQL program to perform addition of two numbers.


18.Write a PL/SQL program to display the first 10 even numbers using a FOR loop.

19.Write a PL/SQL program to check whether a given number is positive, negative or zero.

20.Consider following Schema :


emp1(empno,ename,deptno)
emp2(empno,ename,deptno)
Write SQL commands for the following statements.
1. Display the names of employees including duplicate employee names.
2. Display the names of employees excluding duplicate employee names.
3. Display the common employee names from both the tables.

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.

22.Consider two tables student and course perform differents joins on it


student(s_id,s_name,s_city,c_id)
course(c_id,c_name,prof_name)

23.Write output of the following queries.


i. Create view emp_view as select emp_no, enema, salary from emp;
ii. Update emp_view set e_name=’Jay’ where emp_no=101;
iii. Delete from emp_view where emp_no= 105;
iv. Drop view emp_view;

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)

27.Write a PL/SQL program to display a multiplication table of 5 using FOR loop.

28.Write a PL/SQL program to calculate the prime numbers between 1 to 50.

29.Write a PL/SQL program for displaying details of students studying in computer


department using cursors

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.

33.Write PL/SQL function to calculate the factorial of given no.

34.Create a trigger on the EMP table which is invoked when salary is below 5000 .

You might also like