Oracle Emp Table Script
Oracle Emp Table Script
Group by clause:
Using this we can get values by grouping similar values:
Having clause:
Using this we can give the conditions to group values
JOINS:
Here we are going to learn how to join two distinct tables:
Category 1 : Equi joins
In this we compare two columns which are present in both tables
explanation: in order to distinguish two deptno’s here we used table name before the
column name with ‘.’ Operator.
1.select e.ename,e.sal,s,grade from emp e,salgrade s where e.sal between s.losal and s.hisal
explanation: in EMP table we don’t have record with deptno 40 but we have a record in
DEPT table with deptno 40, so in order to get that record we are using outer join with
employee deptno.
SET Operations:
UNION
UNION ALL
INTERSECT
MINUS
1.select job from emp where deptno=10 UNION select job from emp where deptno=30
Apply all other set operations in the above said way and check the results
VIEW’s
A view is a virtual table which can prepare by combining several columns from different
tables
Explanation :
Here we are creating a view with name d10-view it consists only the employee details who
are working in deptno 10
By this way we can restrict the users from accessing entire table
Now user can get the data from this view by writing the command