Compare commits

..

No commits in common. "9a0ec431bb80c06cdef972d5f72fe3fc52944eb1" and "77fcb8590132ff3426c82c44fc8d19d1c3ed8062" have entirely different histories.

3 changed files with 5 additions and 31 deletions

View File

@ -206,7 +206,7 @@ db.Employee.find({ Designation: { $in: ["Developer", "Tester"] } })
9. Find all documents with exact match on Expertise array:
```mongodb
db.Employee.find({ Expertise: { $all: ["Cloud", "Microservices"] } })
db.Employee.find({ Expertise: { $all: ['Mongodb', 'Mysql', 'Cassandra'] } })
```

View File

@ -1,10 +1,6 @@
## Queries-B2
## Queries
### Group A
> ![NOTE]
> Use Employee database created in Assignment B-01 and perform following aggregation operation
> Refer [Queries-B1](https://git.kska.io/sppu-te-comp-content/DatabaseManagementSystems/src/branch/main/Practical/Assignment-B1/Queries-B1.md)
### A
1. Return Designation with Total Salary Above 200000:
```mongodb
@ -21,7 +17,6 @@ db.Employee.aggregate([
}
}
])
```
2. Find Employee with Total Salary for Each City with Designation "DBA":
@ -37,7 +32,6 @@ db.Employee.aggregate([
}
}
])
```
3. Find Total Salary of Employee with Designation "DBA" for Each Company:
@ -53,7 +47,6 @@ db.Employee.aggregate([
}
}
])
```
4. Returns Names and _id in Upper Case and in Alphabetical Order:
@ -69,13 +62,11 @@ db.Employee.aggregate([
$sort: { Name: 1 }
}
])
```
5. Count All Records from Collection:
```mongodb
db.Employee.countDocuments()
```
6. For Each Unique Designation, Find Avg Salary and Output Sorted by AvgSal:
@ -91,7 +82,6 @@ db.Employee.aggregate([
$sort: { AvgSalary: 1 }
}
])
```
7. Return Separate Value in the Expertise Array Where Name of Employee is "Swapnil":
@ -107,7 +97,6 @@ db.Employee.aggregate([
$project: { Expertise: 1 }
}
])
```
8. Return Separate Value in the Expertise Array and Return Sum of Each Element of Array:
@ -123,7 +112,6 @@ db.Employee.aggregate([
}
}
])
```
9. Return Array for Designation Whose Address is "Pune":
@ -136,7 +124,6 @@ db.Employee.aggregate([
$project: { Designation: 1 }
}
])
```
10. Return Max and Min Salary for Each Company:
@ -150,54 +137,41 @@ db.Employee.aggregate([
}
}
])
```
### Group B
> ![NOTE]
> Use Employee database created in Assignment B-01 and perform following aggregation operation
> Refer [Queries-B1](https://git.kska.io/sppu-te-comp-content/DatabaseManagementSystems/src/branch/main/Practical/Assignment-B1/Queries-B1.md)
### B
1. Create Single Field Indexes on Designation:
```mongodb
db.Employee.createIndex({ Designation: 1 })
```
2. Create Compound Indexes on Name and Age:
```mongodb
db.Employee.createIndex({ "Name.FName": 1, Age: -1 })
```
3. Create Multikey Indexes on Expertise Array:
```mongodb
db.Employee.createIndex({ Expertise: 1 })
```
4. Return a List of All Indexes on Collection:
```mongodb
db.Employee.getIndexes()
```
5. Rebuild Indexes:
```mongodb
db.Employee.reIndex()
```
6. Drop Index on Remove Specific Index:
```mongodb
db.Employee.dropIndex("empIndex")
db.Employee.dropIndex("empIndex")
```
7. Remove All Indexes Except for the _id Index from a Collection:
```mongodb
db.Employee.dropIndexes()
```