0% found this document useful (0 votes)
18 views

SQL Assignment[1]

Oracle assignments

Uploaded by

obitotobi9090
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

SQL Assignment[1]

Oracle assignments

Uploaded by

obitotobi9090
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Dr.

Shyama Prasad Mukherjee University, Ranchi


(Through the Upgradation of Ranchi College, Ranchi)

Department of: MCA

LAB ASSIGNMENT
Paper Code: CPMCA108 Course: MCA
Paper Name: Lab on SQL/PL-SQL Semester: I
Sl Questions Page Remarks
No & Sign
1 Using Oracle, create a table identified below in the following order:

EMP (EMPNO, ENAME, JOB, HIREDATE, SAL, COMM, DEPTNO)


Primary Key: EMPNO
Display the structure of the table.
2

3 Below data to be inserted in the above EMP table:

EMPNO ENAME JOB HIREDATE SAL COMM DEPTNO

-------- --------- ----------- ------------- -------- ------- ----------


7369 SMITH CLERK 17-DEC-80 800 20
7499 ALLEN SALESMAN 20-FEB-81 1600 300 30
7521 WARD SALESMAN 22-FEB-81 1250 500 30
7566 JONES MANAGER 02-APR-81 2975 20
7654 MARTIN SALESMAN 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 01-MAY-81 2850 30
7782 CLARK MANAGER 09-JUN-81 2450 10
7788 SCOTT ANALYST 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 08-SEP-81 1500 0 30
7876 ADAMS CLERK 23-MAY-87 1100 20
7900 JAMES CLERK 03-DEC-81 950 30
7902 FORD ANALYST 03-DEC-81 3000 20
7934 MILLER CLERK 23-JAN-82 1300 10

4 Display the details of all employees.


5 Display the employee name and job for all the employees.
6 Display the employee no and total salary for all the employees.
7 Display the names of all the employees who are working in department number
10.
8 Display the names of all the employees who are working as clerks and drawing a
salary more than 3000.
9 Display the employee number and name who are earning commission.
10 Display the employee number and name who do not earn any commission.
11 Display the names of employees who are working as clerks, salesman or analyst
and drawing a salary more than 3000.
12 Display the names of the employees who are working in the company for the past
5 years.

Submitted to: Dr. A.K. Mohapatra, Asst. Professor


Dr. Shyama Prasad Mukherjee University, Ranchi
(Through the Upgradation of Ranchi College, Ranchi)

Department of: MCA

13 Display the list of employees who have joined the company before 30-JUN-90 or
after 31-DEC-90.

14 Display current Date.

15 Display the list of all users in your database.

16 Display the names of all tables from current user.

17 Display the name of the current user.


18 Display the names of employees working in depart number 10 or 20 or 40 or
employees working as CLERKS, SALESMAN or ANALYST
19 Display the names of employees whose name starts with alphabet S
20 Display the names of employees whose names have second alphabet A in their
names.
21 Display the names of the employee whose names is exactly five Characters in
length
22 Display the names of the employee who are not working as MANAGERS.
23 Display the names of the employee who are not working as SALESMAN OR CLERK
OR ANALYST.

24 Display the total number of employee working in the company.

25 Display the total salary being paid to all employees.

26 Display the maximum salary from emp table.

27 Display the minimum salary from emp table.

28 Display the average salary from emp table.

29 Display the maximum salary being paid to CLERK.

30 Display the maximum salary being paid to depart number 20

31 Display the minimum salary being paid to any SALESMAN.


32 Display the names of the employee in order of salary i.e the name of the employee
earning lowest salary should salary appear first.
33 Display the name of the employee along with their annual salary. The name of the
employee earning highest annual salary should appear first.

34 Display the names of the employee in descending order of salary

35 Display the names of the employee in order of employee name


36 Display department numbers and total number of employees working in each
department.
37 Display the various jobs and total number of employees within each job group.
38 Display the depart numbers and total salary for each department.
39 Display the various jobs and total salary for each job.

Submitted to: Dr. A.K. Mohapatra, Asst. Professor


Dr. Shyama Prasad Mukherjee University, Ranchi
(Through the Upgradation of Ranchi College, Ranchi)

Department of: MCA

40 Increment the salary 1000 to all employees having job MANAGER.


41 Update the job MANAGER whose annual salary is greater than 50000.
42 Add 100 to the commission of each employee whose commission is Null.
43 Delete all CLERKS from the employee table.
44 Delete all employees whose salary is less than 1000.
45 Write PL/SQL code for addition of two numbers Num1 and Num2 values input at
run time and display the sum.
46 Write a PL/SQL program calculate the area of a circle for a value of radius input
at run time.
47 Write a PL/SQL program find out greatest of two numbers values input at run
time.
48 Write a PL/SQL program input a number to check the number is even or odd
49 Write a PL/SQL program calculate factorial of a number.
50 Write a PL/SQL program retrieve empno, ename, job, sal from emp table whose
empno input by the user at run time.

Submitted to: Dr. A.K. Mohapatra, Asst. Professor


Dr. Shyama Prasad Mukherjee University, Ranchi
(Through the Upgradation of Ranchi College, Ranchi)

Department of: MCA

Submitted to: Dr. A.K. Mohapatra, Asst. Professor

You might also like