0% found this document useful (0 votes)
139 views5 pages

Practical Exam Question Bank

Uploaded by

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

Practical Exam Question Bank

Uploaded by

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

1.

SQL commands to create the EMP table with the following


structure:

• empno as a number data type with up to 4 digits


• ename as a variable character data type up to 10 characters
• job as a variable character up to 9 characters
• mgr as a number data type with up to 4 digits

2. Alter the EMP table to assign the empno column as the primary key

3. SQL commands to create the DEPT table with the following


structure:
• deptno as a number with up to 2 digits
• dname as a variable character datatype up to 10 characters
• loc as a variable character up to 20 characters

4. Create a table EMPLOYEE with following schema:


Emp (EMP_no as primary key, E_name, Dept_no, Dept_name, Job_id,
salary)

5. Create tables EMPLOYEE and DEPARTMENT with following


schema
Emp (empno as primary key, empname, salary, phoneno)

6.

7.Consider the following schema


Orders (cust_id, order_id, items, amount)
Write queries for the following:
i. Display new column named total_amount which is 200 added the
amount field.
ii. Display new column named offer_price which is 100 subtracted from
the amount field.
iii. Display new column named revised_amount which is multiplied by 5
times the amount field.
iv. Display new column named half_amount which is divided by 2 to the
amount field.

8. Consider the following schema


Emp(empno,ename,job,mgr,hiredate,sal,comm,deptno)
Write queries for the following:
i. Display employees whose city is ‘Mumbai’ and earns more than 50000
ii. Display employees who job is Clerk or commission is 500

9. Consider the following schema


Emp (empno,ename,job,mgr,hiredate,sal,comm,deptno)
Write queries for the following:

i)Display details of employees whose salary is between 20000 and 50000.


ii). Display details of employees who stays at Mumbai, Pune, Nashik or
Nagpur

10.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.

11. Write any program for Procedure.

12. 1. Calculate cube of following numbers: 10


2. Display details of salary of employees with roundup value.

13. Write output of the following queries.


a. Select sysdate from Dual;
b. Select last_day() from Dual;
c. Select dayofweek() from Dual;
d. Select last_day(sysdate) from Dual;
e. Select monthnow() from Dual;

14. Write output of the following queries.


d. Select last_day(sysdate) from Dual;
e. Select monthnow() from Dual;

15. Consider the following schema


Emp(empno,ename,job,mgr,hiredate,sal,comm,deptno)
1. Display the minimum, maximum, sum and average salary of all
employees.
2. Determine the number of managers without listing them.

16. Write output of the following queries.


a. Display minimum salary of employee from every department;
b. Display total salary of every department.
c. Display details of employees with employee name in ascending order.
d. Display emp_no, dept_no from dept Group By deptname.

17.
1. Display employee Nikhil’s employee number, name, department
number, and department location.
2. Display the list of employees who work in the sales department.
3. Display the list of employees who do not work in the sales department.

18. Write output of the following queries.


i. Create view emp_view as select emp_no, e_name, 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;

19.
a. Create sequence emp_sequence
Incremented by 2
Start with 1
Nomaxvalue
Nocycle
Cache 10;
b. Drop sequence emp_sequence;

20. Write a PL/SQL program that checks if a given number is positive, and
if it is, prints "Number is positive".

21. 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.

22. Write a PL/SQL program to display multiplication table of 5 using


FOR loop.

23. Write a PL/SQL program that asks the user to input a number (1 for
Monday, 2 for Tuesday, ..., 7 for Sunday) and prints the corresponding day
of the week.

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


computer department using cursors.

25. Write a PL/SQL program for Divide by zero exception.


26. Write a PL/SQL program that retrieves the salary of an employee
based on their employee ID (emp_id). If the employee ID does not exist in
the database, handle the NO_DATA_FOUND exception and print a
message saying, "Employee ID not found."

27. Write a PL/SQL program by using the user defined exception.

28. Write PL/SQL function which will compute and return the maximum
of two values.

29.Create a trigger which invokes on updation of record in Department


table

You might also like