My title

page contents


With clause in Oracle

How to find out average salary of employee with total number of employees in each department
suppose person salary is 3000 and number of employees in his department are 4 then his salary is 750(average salary)
so two queries involved here,one which will count how many employees in each department and another query which will find out average salary of employees from their department count.

These type of queries are done using with clause
with dept_cnt as(
select deptno,count(empno) emp_cnt from emp group by deptno)select empno,sal/emp_cnt from emp e ,dept_cnt c where e.deptno=c.deptno;


Pattern searching in scala is very easy, it could be done using match keyword . Successful match will be evaluated by case keyword which provides alternatives for match pattern.

var p:Int=1200
var r:Int=6
var t:Int=5
var intcalc:Int=0
var interest:String=””
println(“Enter SI or CI”);
intcalc=interest match{
case “SI”=>p*r*t/100;
case “CI”=>p+(1+r/100)^t

case _ =>”Wrong choice”
println(s”Interest calc $intcalc”);