select lname,salary ,commission_pct ,coalesce(commission_pct,salary,dailywages) income from edetails;
FNAME LNAME SALARY INCOME
--------------- -------------------- ---------- ----------
sai kiran 23000 23000
jai krishnan 27000 27000
ashok kumar 27000 .1
Geethu Mohan 27000 .3
Arafat Aboobacker 27000 .2
Seetha Raman 24000 .2
Urmilla Unni 28000 .2
Sajesh Kumar 29000 .2
Rajesh C 25000 .2
Manu Jayan 29000 .2
Santhosh Jayan 22000 .2
FNAME LNAME SALARY INCOME
--------------- -------------------- ---------- ----------
hari prasad 500
12 rows selected.
select lname,salary ,commission_pct ,dailywages,
coalesce(commission_pct,salary,dailywages) income from
edetails;
LNAME SALARY COMMISSION_PCT INCOME
-------------------- ---------- -------------- ----------
kiran 23000 23000
krishnan 27000 27000
kumar 27000 .1 .1
Mohan 27000 .3 .3
Aboobacker 27000 .2 .2
Raman 24000 .2 .2
Unni 28000 .2 .2
Kumar 29000 .2 .2
C 25000 .2 .2
Jayan 29000 .2 .2
Jayan 22000 .2 .2
LNAME SALARY COMMISSION_PCT INCOME
-------------------- ---------- -------------- ----------
prasad 500
12 rows selected.
SQL> select lname,salary ,commission_pct ,dailywages,
2 coalesce(commission_pct,salary,dailywages) income from
3 edetails;
LNAME SALARY COMMISSION_PCT DAILYWAGES INCOME
-------------------- ---------- -------------- ---------- ----------
kiran 23000 23000
krishnan 27000 27000
kumar 27000 .1 .1
Mohan 27000 .3 .3
Aboobacker 27000 .2 .2
Raman 24000 .2 .2
Unni 28000 .2 .2
Kumar 29000 .2 .2
C 25000 .2 .2
Jayan 29000 .2 .2
Jayan 22000 .2 .2
LNAME SALARY COMMISSION_PCT DAILYWAGES INCOME
-------------------- ---------- -------------- ---------- ----------
prasad 500 500
12 rows selected.
select fname ,salary from edetails e where salary >= (select avg(salary) from edetails ed where
ed.deptid=e.deptid);
FNAME SALARY
--------------- ----------
jai 27000
ashok 27000
Geethu 27000
Arafat 27000
Urmilla 28000
Sajesh 29000
Manu 29000
select fname , salary from edetails
where salary >any(25000,28000);
FNAME SALARY
--------------- ----------
jai 27000
ashok 27000
Geethu 27000
Arafat 27000
Urmilla 28000
Sajesh 29000
Manu 29000
select fname , salary from edetails
where salary >all(25000,28000);
FNAME SALARY
--------------- ----------
Sajesh 29000
Manu 29000
select fname , salary from edetails
where salary <all(25000,28000);
FNAME SALARY
--------------- ----------
sai 23000
Seetha 24000
Santhosh 22000
select fname , salary from edetails
where salary <any(25000,28000);
FNAME SALARY
--------------- ----------
sai 23000
jai 27000
ashok 27000
Geethu 27000
Arafat 27000
Seetha 24000
Rajesh 25000
Santhosh 22000
8 rows selected.
select fname , salary from edetails
where salary >some(25000,28000);
FNAME SALARY
--------------- ----------
jai 27000
ashok 27000
Geethu 27000
Arafat 27000
Urmilla 28000
Sajesh 29000
Manu 29000
select fname , salary from edetails
where salary in(25000,28000);
FNAME SALARY
--------------- ----------
Urmilla 28000
Rajesh 25000
FNAME LNAME SALARY INCOME
--------------- -------------------- ---------- ----------
sai kiran 23000 23000
jai krishnan 27000 27000
ashok kumar 27000 .1
Geethu Mohan 27000 .3
Arafat Aboobacker 27000 .2
Seetha Raman 24000 .2
Urmilla Unni 28000 .2
Sajesh Kumar 29000 .2
Rajesh C 25000 .2
Manu Jayan 29000 .2
Santhosh Jayan 22000 .2
FNAME LNAME SALARY INCOME
--------------- -------------------- ---------- ----------
hari prasad 500
12 rows selected.
select lname,salary ,commission_pct ,dailywages,
coalesce(commission_pct,salary,dailywages) income from
edetails;
LNAME SALARY COMMISSION_PCT INCOME
-------------------- ---------- -------------- ----------
kiran 23000 23000
krishnan 27000 27000
kumar 27000 .1 .1
Mohan 27000 .3 .3
Aboobacker 27000 .2 .2
Raman 24000 .2 .2
Unni 28000 .2 .2
Kumar 29000 .2 .2
C 25000 .2 .2
Jayan 29000 .2 .2
Jayan 22000 .2 .2
LNAME SALARY COMMISSION_PCT INCOME
-------------------- ---------- -------------- ----------
prasad 500
12 rows selected.
SQL> select lname,salary ,commission_pct ,dailywages,
2 coalesce(commission_pct,salary,dailywages) income from
3 edetails;
LNAME SALARY COMMISSION_PCT DAILYWAGES INCOME
-------------------- ---------- -------------- ---------- ----------
kiran 23000 23000
krishnan 27000 27000
kumar 27000 .1 .1
Mohan 27000 .3 .3
Aboobacker 27000 .2 .2
Raman 24000 .2 .2
Unni 28000 .2 .2
Kumar 29000 .2 .2
C 25000 .2 .2
Jayan 29000 .2 .2
Jayan 22000 .2 .2
LNAME SALARY COMMISSION_PCT DAILYWAGES INCOME
-------------------- ---------- -------------- ---------- ----------
prasad 500 500
12 rows selected.
select fname ,salary from edetails e where salary >= (select avg(salary) from edetails ed where
ed.deptid=e.deptid);
FNAME SALARY
--------------- ----------
jai 27000
ashok 27000
Geethu 27000
Arafat 27000
Urmilla 28000
Sajesh 29000
Manu 29000
select fname , salary from edetails
where salary >any(25000,28000);
FNAME SALARY
--------------- ----------
jai 27000
ashok 27000
Geethu 27000
Arafat 27000
Urmilla 28000
Sajesh 29000
Manu 29000
select fname , salary from edetails
where salary >all(25000,28000);
FNAME SALARY
--------------- ----------
Sajesh 29000
Manu 29000
select fname , salary from edetails
where salary <all(25000,28000);
FNAME SALARY
--------------- ----------
sai 23000
Seetha 24000
Santhosh 22000
select fname , salary from edetails
where salary <any(25000,28000);
FNAME SALARY
--------------- ----------
sai 23000
jai 27000
ashok 27000
Geethu 27000
Arafat 27000
Seetha 24000
Rajesh 25000
Santhosh 22000
8 rows selected.
select fname , salary from edetails
where salary >some(25000,28000);
FNAME SALARY
--------------- ----------
jai 27000
ashok 27000
Geethu 27000
Arafat 27000
Urmilla 28000
Sajesh 29000
Manu 29000
select fname , salary from edetails
where salary in(25000,28000);
FNAME SALARY
--------------- ----------
Urmilla 28000
Rajesh 25000