0% found this document useful (0 votes)
22 views1 page

Program 2

The document details the creation of a view in Oracle SQL to display employees who work on more than one project by filtering the employee table where the employee number is in a subquery that groups and counts the employee numbers in the project table having a count greater than 1. The view is created and 2 employees who work on multiple projects are displayed.

Uploaded by

anjnasharma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views1 page

Program 2

The document details the creation of a view in Oracle SQL to display employees who work on more than one project by filtering the employee table where the employee number is in a subquery that groups and counts the employee numbers in the project table having a count greater than 1. The view is created and 2 employees who work on multiple projects are displayed.

Uploaded by

anjnasharma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Program - 2

AIM: Create a view to display details of employees


working on more than one project.

SQL> select * from project;

EMPNO P_NAME
---------- ---------
1 p1
2 p2
3 p3
5 p4
1 p3
2 p4

6 rows selected.

SQL> select * from emp;

EMPNO EMPNAME CITY SALARY BAL-AMOUNT


---------- --------------- ------------------ -----------
1 RAJNISH KKR 50000 2000
2 KUNWAR KKR 200000 67898
3 SANDEEP KARNAL 100000 7890
4 NAVDEEP AJMER 10000 5678
5 AKHIL KARNAL 200000 5678

SQL> create view v1 as select * from emp where empno IN (select empno from
project group by empno having count(empno>1));

View created.

SQL> select * from v1;

EMPNO EMPNAME CITY SALARY BAL-AMOUNT


----------- --------------- ------- ------------ --------------------
1 RAJNISH KKR 50000 2000
2 KUNWAR KKR 20000 67898

You might also like