All Assignments
All Assignments
All Assignments
Database Assignment 1
Note : Use Emp, dept and salgrade table
1.To list all records with sal > 2000 and comm>200
select * from emp
-> where sal > 2000 and comm > 200;
6. To list all employees with job starts with C and ends with K
select * from emp
-> where job like
-> 'C%' and job like '%K';
7. To list all employees with job contains L at third position and M at third
last position
select * from emp
-> where job like
-> '__L%' and job like '%M__';
8.To list all the record with sal not equal to 1250 or 1100 or 2850
select * from emp
-> where sal not in(1100, 1250, 2850);
10. To list all employees with job starts with C , E at 3rd position and ends with
K
select * from emp
-> where job like
-> 'C_E%K';
To list all employees with comm is null and name starts with ‘S’
12.
select * from emp
-> where comm is null
-> and ename like 'S%';
To list all employees with job contains 5 characters
13.
select * from emp
-> where job like '_____';
14. To list all employees with name contain ‘A’ at 1 position and job Contains
5 characters
select * from emp
-> where job REGEXP '^A.{4}';
Assignment 2
Q2. Solve the following
1. Retrieve the details (Name, Salary and dept no) of the emp who
are working in department code 20, 30 and 40.
select * from emp
where deptno in(20,30,40);
3. List the Name and job of the emp who have joined before 1 jan
1986 and whose salary range is between 1200and 2500. Display
the columns with user defined Column headers.
select ename, hiredate, job, sal
-> from emp
-> where hiredate < '1986-01-01'
-> and (sal between 1200 and 1500);
4. List the empno, name, and department number of the emp
works under manager with id 7698
select ename, empno, deptno
-> from emp
-> where mgr = 7698;
5. List the name, job, and salary of the emp who are working in
departments 10 and 30.
select ename, job, sal
-> from emp
-> where deptno in(10,30);
6. Display name concatenated with dept code separated by comma
and space. Name the column as ‘Emp info’.
select concat(ename,' , ',job) 'Emp Info'
-> from emp;
7. Display the emp details who do not have manager.
select * from emp
-> where mgr is null;
Or
select ename, job
-> from emp
-> where job REGEXP '^.*AGE.*$';
11. List the details of the employee , whose names start with ‘A’ and
end with ‘S’ or whose names contains N as the second or third
character, and ending with either ‘N’ or ‘S’.
select * from emp where ename like ‘A%S’ or ename like ‘_N%N’ or
ename like ‘_N%S’ or ename like ‘__N%N’ or ename like ‘__N%S’ or
select * from emp where ename REGEXP ‘^A.*S$| ^..?N.*[NS]$‘
select ename
-> from emp
-> where ename REGEXP '^A.*S$|^..?N.*[NS]$';
12. List the names of the emp having ‘_’ character in their name.
select ename
-> from emp
-> where ename REGEXP '^[_]$';
3. List the empno, name, and department number of the emp who
have experience of 18 or more years and sort them based on their
experience.
select ename, empno, deptno, sal,
-> year(curdate())- year(hiredate) 'Experience'
-> from emp
-> where year(curdate())- year(hiredate) > 18
-> order by sal;
1. Display the Highest, Lowest, Total & Average salary of all employee. Label
the columns Maximum, Minimum, Total and Average respectively for each
Department. Also round the result to the nearest whole number.
select round(max(sal),2) 'Maximum', round(min(sal),2)
'Minimum',round(sum(sal),2) 'Total Salary', round(avg(sal),2) 'Average Salary'
-> from emp;
3. Get the Department number, and sum of Salary of all non managers where
the sum is greater than 20000.
select deptno, sum(sal)
-> from emp
-> where job !='manager'
-> group by deptno
-> having sum(sal) > 20000;
1. Write a query to display the first day of the month (in datetime format) three months before the
current month.
Sample current date : 2014-09-03
Expected result : 2014-06-01
3. Write a query to get the distinct Mondays from hiredate in emp tables.
8. Write a query to get the current date in Thursday September 2014 format. Thursday September
2014
10. Write a query to get the first name and hire date from employees table where hire date between
'1987-06-01' and '1987-07-30'
11. Write a query to display the current date in the following format. Sample output: Thursday 4th
September 2014 00:00:00
==>select date_format(curdate(),'%W ' '%D ' '%M ' '%Y ' '%T');
12. Write a query to display the current date in the following format. Sample output: 05/09/2014
13. Write a query to display the current date in the following format. Sample output: 12:00 AM Sep
5, 2014
==> select date_format(curdate(), '%r ' '%M ' ', ' '%Y');
14. Write a query to get the employees who joined in the month of June.
16. Write a query to get first name of employees who joined in 1987.
17. Write a query to get employees whose experience is more than 5 years.
select ename
19. Write a query to get first name, hire date and experience of the employees.
20. Write a query to get the department ID, year, and number of employees joined.
dloc varchar(20)
)
mname varchar2(15),
dept--- deptno
salgrade---
grade
constarint in emp
deptno --->>
dept(deptno)
add new column in emp table netsal with constraint default 1000
44.list all employees with salary > either Smith's salary or alan's sal
select ename, sal from emp
-> where sal > (select sal from emp where ename='smith')
-> or sal > (select sal from emp where ename='allen');
45.list all employees who earn more than average sal of dept 10
select ename, sal, deptno
-> from emp
-> where sal > (select avg(sal) from emp where deptno=10);
46.list all employees who earn more than average sal of Alan's
department
select ename, sal
-> from emp
-> where sal > (select avg(sal) from emp
-> where deptno=(select deptno from emp where ename='allen'));
47.list all employees who are working in purchase department
Empty set, no such a dept
48.list all employees who earn more than average salary of their own
department
select ename, sal, deptno
-> from emp e
-> where sal > (select avg(sal) from emp b where b.deptno=e.deptno);
49.list all employees who earn sal < than their managers salary
select ename, sal from emp w where w.sal< (
-> select sal from emp m where w.mgr=m.empno);
50.list all employees who are earning more than average salary of
their job
select e.ename, e.sal, e.job from emp e, emp m
-> where e.sal > (select avg(sal) from emp m where m.job=e.job) and
m.ename=e.ename;
product(pid,pname,price,qty,cid,sid)
salesman (sid,sname,address)
category(cid,cnam,descritpion)
i. list all product name,their category name and name of
a person, who sold that product
select pname, cname, sname
-> from product p, category c, salesman s
-> where p.cid=c.cid and p.sid=s.salesmanid;
ii. list all product name and salesman name for all
salesman who stays in pune
faculty(fid,fname,sp.skill1,sp.skill2)
courses(cid,cname,rid,fid)
room(roomid,rnam
e,rloc) faculty
courses
cid cname rid fid
Room
roomid rname rloc
2. list all faculties who are not allocated to any course and
rooms which are not allocated to any course
select f.fid, f.fname, r.roomno,r.rname
-> from faculty f join room r join course c
-> on c.fid is null or r.roomno not exists in (select t.rid
-> from course t);
3. list all rooms which are allocated or not allocated to any
courses
select * from room;
description
PL-SQL
Assignment
Solve the following
2. write a procedure to delete record from employee table. the procedure should accept
empno as input parameter.
write delete statement inside procedure delete_emp to delete one record from emp
table
delimiter //
create procedure delete_emp(vempno int)
begin
delete from emp
where vempno = empno;
end //
4. write a procedure to find min,max,avg of salary and number of employees in the given
deptno.
deptno --→ in parameter
min,max,avg and count ---→ out type parameter
execute procedure and then display values min,max,avg and count
delimiter //
create procedure minmax(vdeptno int, out vmin decimal(9,2),
out vmax decimal(9,2), out vavg decimal(9,2), out vcount int)
begin
select min(sal), max(sal), avg(sal), count(*)
from emp
where deptno = vdeptno;
end //
6. write a procedure to display all vehicles bought by a customer. pass cutome name as a
parameter.(use vehicle,salesman,custome and relation table)
7. Write a procedure that displays the following information of all emp
Empno,Name,job,Salary,Status,deptno
Note: - Status will be (Greater, Lesser or Equal) respective to average salary of their own
department. Display an error message Emp table is empty if there is no matching record.
delimiter //
begin
open emp_cur;
label11:loop
if vstop=1 then
if vcnt=0 then
end if;
leave label11;
end if;
set vcnt=vcnt+1;
from emp
where deptno=vdeptno;
if vsal<vavgsal then
set vstatus='lesser';
set vstatus='greater';
else
set vstatus='equal';
end if;
select vempno,vename,vsal,vavgsal,vdeptno,vstatus;
update emp
set status=vstatus
where empno=vempno;
end loop;
close emp_cur;
end//
call displaystatusinfo();
8. Write a procedure to update salary in emp table based on following rules.
Exp< =35 then no Update
Exp> 35 and <=38 then 20% of salary
Exp> 38 then 25% of salary
10. Write a function to compute the following. Function should take sal and hiredate as i/p
and return the cost to company.
DA = 15% Salary, HRA= 20% of Salary, TA= 8% of Salary.
Special Allowance will be decided based on the service in the company. < 1
Year Nil
>=1 Year< 2 Year 10% of Salary
>=2 Year< 4 Year 20% of Salary
>4 Year 30% of Salary
SET GLOBAL log_bin_trust_function_creators = 1;
delimiter //
create function cost_to_company(vsal decimal(9,2), hiredate date) returns decimal(9,2)
begin
declare cost, spallow decimal(9,2);
declare vexp int;
set vexp = getexperience(hiredate);
set cost = 0.15 * vsal + 0.20 * vsal + 0.08 * vsal;
if vexp >= 1 and vexp <= 2
then
set spallow = 0.10 * vsal;
elseif
vexp >= 2 and vexp <= 4 then
set spallow = 0.20 * vsal;
elseif
vexp >= 4 then
set spallow = 0.30 * vsal;
end if;
set cost = cost + spallow + vsal;
return cost;
end //
11. Write query to display empno,ename,sal,cost to company for all employees(note:
use function written in question 10)
select empno, ename, sal, cost_to_company(sal,hiredate)
from emp;
create table
emp_back( empno int,
ename varchar(20), oldsal
decimal(9,2),
newsal decimal(9,2)
)
(note :
execute procedure written in Q8 and
check the entries in EMP_back table after execution of the procedure)
delimiter //
create trigger update_emp after update on emp
for each row
begin
insert into emp_back values(OLD.empno,OLD.ename,OLD.sal,NEW.sal);
end//
2. Write a trigger which add entry in audit table when user tries to insert or delete records
in employee table store empno,name,username and date on which operation per-
formed and which action is done insert or delete. in emp_audit table. create table be-
fore writing trigger.
create table emp_audit
(
empno int,
ename varchar(20),
username varchar(20),
chdate date,
action_type varchar(20)
);
delimiter //
create trigger insert_emp after insert on emp
for each row
begin
insert into emp_audit values(NEW.empno,NEW.ename,user(),curdate(),'insert');
end //
delimiter //
create trigger delete_emp before delete on emp
for each row
begin
insert into emp_audit values(OLD.empno,OLD.ename,user(),curdate(),'delete');
end //
3. ); Create table vehicle_history. Write a trigger to store old vehicleprice and new vehicle
price in history table before you update price in vehicle table (note: use vehicle table).
create table
varchar(20), oldprice
decimal(9,2), newprice
username varchar(20)
);
MongoDb Day 1
1. Write a MongoDB query to display all the documents in the collection restaurants
db.restaurent.find().pretty()
2. Write a MongoDB query to display the fields restaurant_id, name, borough and cuisine for all the doc-
uments in the collection restaurant.
db.restaurent.find({},{restaurent_id:1,name:1,borouugh:1,cuisine:1}).pretty()
3. Write a MongoDB query to display the fields restaurant_id, name, borough and cuisine, but exclude
the field _id for all the documents in the collection restaurant.
db.restaurent.find({},{restaurent_id:1,name:1,borouugh:1,cuisine:1,_id:0}).pretty()
4. Write a MongoDB query to display the fields restaurant_id, name, borough and zip code, but exclude
the field _id for all the documents in the collection restaurant.
db.restaurent.find({},{restaurent_id:1,name:1,borouugh:1,'address.zipcode':1,_id:0}).pretty()
5. Write a MongoDB query to display all the restaurant which is in the borough Bronx
db.restaurent.find({borough:'Bronx'}).pretty()
6. Write a MongoDB query to display the first 5 restaurant which is in the borough Bronx.
db.restaurent.find({borough:'Bronx'}).pretty().limit(5)
7.Write a MongoDB query to display the next 5 restaurants after skipping first 5 which are in the
borough Bronx.
db.restaurent.find({borough:'Bronx'}).pretty().limit(5).skip(5)
8. Write a MongoDB query to find the restaurants who achieved a score more than 90.
db.restaurent.find({grades:{$elemMatch:{score:{$gt:90}}}}).pretty()
9. Write a MongoDB query to find the restaurants that achieved a score, more than 80 but less than
100.
db.restaurent.find({grades:{$elemMatch:{score:{$gt:80, $lt:100}}}}).pretty()
10. Write a MongoDB query to find the restaurants which locate in latitude value less than -
95.754168.
db.restaurent.find({'address.coord.1':{$lt:95.754168}}).pretty()
11. Write a MongoDB query to find the restaurants that do not prepare any cuisine of 'American' and
their grade score more than 70 and latitude less than -65.754168.
db.restaurent.find({'address.coord.0':{$lt:-65.754168},cuisine:{$nin:['American']},'grades.score':
{$gt:70}}).pretty()
12. Write a MongoDB query to find the restaurants which do not prepare any cuisine of 'American' and
achieved a score more than 70 and located in the longitude less than 65.754168.
db.restaurent.find({cuisine:{$nin:['American']}, 'grades.score':{$gt:70},'address.coord.1':
{$lt:65.754168}}).pretty()
13. Write a MongoDB query to find the restaurants which do not prepare any cuisine of 'American ' and
achieved a grade point 'A' not belongs to the borough Brooklyn. The document must be displayed
according to the cuisine in descending order.
db.restaurent.find({name:/^Wil.*$/},{restaurent_id:1,name:1,borough:1,cuisine:1,_id:0}).pretty()
15. Write a MongoDB query to find the restaurant Id, name, borough and cuisine for those restaurants
which contain 'ces' as last three letters for its name.
db.restaurent.find({name:/^.*ces$/},{restaurent_id:1,name:1,borough:1,cuisine:1,_id:0}).pretty()
16. Write a MongoDB query to find the restaurant Id, name, borough and cuisine for those restaurants
which contain 'Reg' as three letters somewhere in its name.
db.restaurent.find({name:/^.*Reg.*$/},{restaurent_id:1,name:1,borough:1,cuisine:1,_id:0}).pretty()
17. Write a MongoDB query to find the restaurants which belong to the borough Bronx and prepared ei-
ther American or Chinese dish.
db.restaurent.find({borough:'Bronx',cuisine:{$in:['American','Chinese']}}).pretty()
18. Write a MongoDB query to find the restaurant Id, name, borough and cuisine for those restaurants
which belong to the borough Staten Island or Queens or Bronxor Brooklyn.
db.restaurent.find({borough:{$in:['Staten Island','Queens','Bronx','Brooklyn']}},
{_id:0,address:0}).pretty()
19. Write a MongoDB query to find the restaurant Id, name, borough and cuisine for those restaurants
which are not belonging to the borough Staten Island or Queens or Bronxor Brooklyn.
db.restaurent.find({borough:{$nin:['Staten Island','Queens','Bronx','Brooklyn']}},
{_id:0,address:0}).pretty()
20. Write a MongoDB query to find the restaurant Id, name, borough and cuisine for those restaurants
which achieved a score which is not more than 10.
db.restaurent.find({'grades.score':{$lte:10}}).pretty()
21. Write a MongoDB query to find the restaurant Id, name, borough and cuisine for those restaurants
which prepared dish except 'American' and 'Chinees' or restaurant's name begins with letter 'Wil'.
db.restaurent.find({$in:[{cuisine:{$nin:['American','Chinese']}},{name:/^Wil/}]}).pretty()
22. Write a MongoDB query to find the restaurant Id, name, and grades for those restaurants which
achieved a grade of "A" and scored 11 on an ISODate "2014-08-11T00:00:00Z" among many of sur-
vey dates
db.restaurent.find({grades:{$elemMatch:{"date" : ISODate("2014-08-11T00:00:00Z"),"grade" :
"A","score" : 11}}},{restaurant_id:1,name:1,grades:1,_id:0}).pretty()
23. Write a MongoDB query to find the restaurant Id, name and grades for those restaurants where the
2nd element of grades array contains a grade of "A" and score 9 on an ISODate "2014-08-
11T00:00:00Z".
db.restaurent.find({'grades.1':{$elemMatch:{"date" : ISODate("2014-08-11T00:00:00Z"),"grade" :
"A","score" :9}}},{restaurant_id:1,name:1,grades:1,_id:0}).pretty()
24. Write a MongoDB query to find the restaurant Id, name, address and geographical location for those
restaurants where 2nd element of coord array contains a value which is more than 42 and upto 52
db.restaurent.find({'address.coord.1':{$gt:42, $lte:52}}).pretty().limit(5)
25. Write a MongoDB query to arrange the name of the restaurants in ascending order along with all
the columns.
db.restaurent.find().sort({name:1}).pretty().limit(5)
26. Write a MongoDB query to arrange the name of the restaurants in descending along with all the col-
umns.
db.restaurent.find({}).sort({name:-1}).pretty().limit(3)
27. Write a MongoDB query to arranged the name of the cuisine in ascending order and for that same
cuisine borough should be in descending order.
db.restaurent.find({},{_id:0,address:0,grades:0}).sort({cuisine:1, borough:-1}).pretty().limit(5)
28. Write a MongoDB query to know whether all the addresses contains the street or not.
db.restaurent.find({'address.street':{$nin:[null]}}).pretty().limit(5)
29. Write a MongoDB query which will select all documents in the restaurants collection where the co-
ord field value is Double.
db.restaurent.find({'address.coord':{$type:'double'}}).pretty()
30. Write a MongoDB query which will select the restaurant Id, name and grades for those restaurants
which returns 0 as a remainder after dividing the score by 7.
db.restaurent.find({name:/mon/},{name:1,borough:1,coord:1,cuisine:1,_id:0})
32. Write a MongoDB query to find the restaurant name, borough, longitude and latitude and cuisine
for those restaurants which contain 'Mad' as first three letters of its name.
db.restaurent.find({name:/^Mad/},{name:1,borough:1,coord:1,cuisine:1,_id:0})
Create a Employee Collection add 5 documents: Example:
{empno:111,ename:”Deepali
Vaidya”,sal:40000.00,dept:{deptno12,dname:,”Hr”,dloc:”Mumbai},
Desg:”Analyst”,mgr:{name:”Satish”,num:111},project:[{name:”Project-
1”,Hrs:4},{name:”project- 2”,Hrs:4}]}
db.Employee.insert({empno:111,ename:'Deepali Vaidya',sal:40000.00,dept:
{deptno12,dname:,'Hr',dloc:'Mumbai'}, Desg:'Analyst',mgr:{name:'Satish',num:111},project:
[{name:'Projec1',Hrs:4},{name:'project- 2',Hrs:4}]})
MongoDb Day 2
1. All Employee’s with the desg as ‘CLERK’ are now called as (AO) Administrative Officers. Update
the Employee collection for this.
==> db.Employee.update({Desg:'CLERK'},{$set:{Desg:'Administrative Officres'}})
2. Change the number of hours for project-1 to 5 for all employees with designation analyst.
==> db.Employee.update({Desg:'Analyst'},{$set:{'project.0.Hrs':5}},{multi:true})
3. Add 2 projects project-3 and project-4 for employee whose name starts with ”Deep” with 2 hrs
I am using here ‘Abh’ with project-5,project-6
==> db.Employee.update({ename:/^Abh/},{$push:{project:{$each:[{name:'Project-5',Hrs:2},
{name:'Project-6',Hrs:2}]}}},{multi:true})
4. Add bonus rs 2000 for all employees with salary > 50000
==> db.Employee.update({sal:{$gt:50000}},{$inc:{bonus:2000}},{multi:true})
5. Add bonus rs 1500 if salary <50000 and > 30000
==>db.Employee.update({sal:{$gte:30000,$lte:50000}},{$inc:{bonus:1500}},{multi:true})
6. increment bounus by 1000 for all employees if salary <=30000
==> db.Employee.update({sal:{$lte:30000}},{$inc:{bonus:1000}},{multi:true})
7. Change manager name to Tushar for all employees whose manager is currently “satish” And
manager number to 3333
==> b.Employee.update({'mgr.name':'Satish'},{$set:{'mgr.name':'Tushar','mgr.num':3333}},
{multi:true})
9. Decrease number of hrs by 2 for all employees who are working on project-2
==>
db.Employee.update({project:{$elemMatch:{name:'Project-2'}}},{$inc:{'project.1.Hrs':-2}},
{multi:true})
db.Employee.update({'project.name':'project-2'},{$inc:{'project.3.Hrs':-2}},{multi:true})
10. Delete project-2 from all employee document if they are working on the project for 4 hrs.
==> db.Employee.update({project:{$elemMatch:{name:'Project-2',Hrs:4}}},{$unset:{project:
{$elemMatch:{name:'',Hrs:''}}}},{multi:true})
acknowledged: true,
insertedId: null,
matchedCount: 0,
modifiedCount: 0,
upsertedCount: 0
11. Change the salary of employees to 10000 only if their salary is < 10000
==>db.Employee.update({sal:{$gt:10000}},{$set:{sal:10000}},{multi:true})
12. Increase bonus of all employees by 500 if the bonus is <2000 or their salary is <
20000 or if employee belong to sales department
==>
db.Employee.update({$or:[{sal:{$gt:20000},bonus:{$lt:2000}}],dname:'Sales'},{$inc:
{bonus:500}},{multi:true})
13. Add 2 new project at position 2 for all employees with designation analyst or salary is equal to
either 30000 or 33000 or 35000
==> db.Employee.update({$or:[{Desg:'Analyst'},sal:{$in:[30000,33000,35000]}]},{$set:{'project.1':
{name:'Project-11',Hrs:2},'project.2':{name:'Project-22',Hrs:2}}},{multi:true})
14. Delete last project of all employees with department name is “HR” and if the location is Mumbai
==>db.Employee.update({'dept.dname':'Hr','dept.dloc':'Mumbai'},{$pop:{project:1}},{multi:true})
15. Change designation of all employees to senior programmer if they are working on
name:”Project-1” for 4 hrs
==>db.Employee.update({project:{$elemMatch:{name:'Project-1',Hrs:4}}},{$set:{Desg:'Senior
Programmer'}},{multi:true})
16. Add list of hobbies in all employees document whose manager is Rajan or Revati
==>db.Employee.update({'mgr.name':{$in:['Madhu','Suyash']}},{$set:{hobbies:['Swimming','Playing
Cricket']}},{multi:true})
17. Add list of skillset in all employee documents who are working on project-4 for 3 hrs or on
project-3 for 4 hrs
==>db.Employee.update({$or:[{project:{$elemMatch:{name:'Project-4',Hrs:4}}},{project:
{$elemMatch:{name:'Project-3',Hrs:4}}}]},{$set:{Skillset:['Java','.NET']}},{multi:true})
18. Add a new hobby as blogging at 3 position in hobbies array for all employess whose name starts
with R or p and ends with j or s
==> db.Employee.update({ename:/^[OS].*[el]$/},{$push:{Skillset:'Blogging'}},{multi:true})
19. Increase salary by 10000 for all employees who are working on project-2 or project-3 or project-
1
==> db.Employee.find({$or:[{project:{$elemMatch:{name:'Project-1'}}},{project:{$elemMatch:
{name:'Project-2'}}},{project:{$elemMatch:{name:'Project-3'}}}]},{$inc:{sal:10000}},{multi:true})
Decrease bonus by 1000 rs And increase salary by 1000rs for all employees whose department
location is Mumbai
==>db.Employee.find({'dept.dname':'Mumbai'},{$inc:{sal:1000},{$inc:{bonus:-1000}}},
{multi:true})
23. Add 2 skills MongoDb and Perl at the end of skillset array for all employees who are working at
Pune location
==> db.Employee.update({'dept.dloc':'Pune'},{$push:{Skillset:['MongoDb','Perl']}},{multi:true})
24. Delete first hobby from hobby array for all employees who are working on project-1 or project-2
==> db.Employee.update({$or:[{project:{$elemMatch:{name:'Project-1'}}},{project:{$elemMatch:
{name:'Project-2'}}}]},{$pop:{hobbies:-1}},{multi:true})
25. Delete last hobby from hobbies array for all employees who are working on project which is at 2
nd position in projects array for 4 hrs
==>db.Employee.update({project:{$elemMatch:{Hrs:4}}},{$pop:{hobbies:1}},{multi:true})
26. Add 2 new projects at the end of array for all employees whose skillset contains Perl or python
==>db.Employee.update({Skillset:{$in:['Python','Perl']}},{$push:{project:
{name:'Project_new2',Hrs:10}}},{multi:true})
db.Employee.update({Skillset:{$in:['Python','Perl']}},{$push:{project:{name:'Project_new1',Hrs:10}}},
{multi:true})
27. Change hrs to 6 for project-1 for all employees if they working on the project-1 for < 6 hrs.
otherwise keep the existing value.
==>
Notes: