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: 9. Find all documents with exact match on Expertise array:
```mongodb ```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 ### 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)
1. Return Designation with Total Salary Above 200000: 1. Return Designation with Total Salary Above 200000:
```mongodb ```mongodb
@ -21,7 +17,6 @@ db.Employee.aggregate([
} }
} }
]) ])
``` ```
2. Find Employee with Total Salary for Each City with Designation "DBA": 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: 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: 4. Returns Names and _id in Upper Case and in Alphabetical Order:
@ -69,13 +62,11 @@ db.Employee.aggregate([
$sort: { Name: 1 } $sort: { Name: 1 }
} }
]) ])
``` ```
5. Count All Records from Collection: 5. Count All Records from Collection:
```mongodb ```mongodb
db.Employee.countDocuments() db.Employee.countDocuments()
``` ```
6. For Each Unique Designation, Find Avg Salary and Output Sorted by AvgSal: 6. For Each Unique Designation, Find Avg Salary and Output Sorted by AvgSal:
@ -91,7 +82,6 @@ db.Employee.aggregate([
$sort: { AvgSalary: 1 } $sort: { AvgSalary: 1 }
} }
]) ])
``` ```
7. Return Separate Value in the Expertise Array Where Name of Employee is "Swapnil": 7. Return Separate Value in the Expertise Array Where Name of Employee is "Swapnil":
@ -107,7 +97,6 @@ db.Employee.aggregate([
$project: { Expertise: 1 } $project: { Expertise: 1 }
} }
]) ])
``` ```
8. Return Separate Value in the Expertise Array and Return Sum of Each Element of Array: 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": 9. Return Array for Designation Whose Address is "Pune":
@ -136,7 +124,6 @@ db.Employee.aggregate([
$project: { Designation: 1 } $project: { Designation: 1 }
} }
]) ])
``` ```
10. Return Max and Min Salary for Each Company: 10. Return Max and Min Salary for Each Company:
@ -150,54 +137,41 @@ db.Employee.aggregate([
} }
} }
]) ])
``` ```
### Group B ### 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)
1. Create Single Field Indexes on Designation: 1. Create Single Field Indexes on Designation:
```mongodb ```mongodb
db.Employee.createIndex({ Designation: 1 }) db.Employee.createIndex({ Designation: 1 })
``` ```
2. Create Compound Indexes on Name and Age: 2. Create Compound Indexes on Name and Age:
```mongodb ```mongodb
db.Employee.createIndex({ "Name.FName": 1, Age: -1 }) db.Employee.createIndex({ "Name.FName": 1, Age: -1 })
``` ```
3. Create Multikey Indexes on Expertise Array: 3. Create Multikey Indexes on Expertise Array:
```mongodb ```mongodb
db.Employee.createIndex({ Expertise: 1 }) db.Employee.createIndex({ Expertise: 1 })
``` ```
4. Return a List of All Indexes on Collection: 4. Return a List of All Indexes on Collection:
```mongodb ```mongodb
db.Employee.getIndexes() db.Employee.getIndexes()
``` ```
5. Rebuild Indexes: 5. Rebuild Indexes:
```mongodb ```mongodb
db.Employee.reIndex() db.Employee.reIndex()
``` ```
6. Drop Index on Remove Specific Index: 6. Drop Index on Remove Specific Index:
```mongodb ```mongodb
db.Employee.dropIndex("empIndex") db.Employee.dropIndex("empIndex")
``` ```
7. Remove All Indexes Except for the _id Index from a Collection: 7. Remove All Indexes Except for the _id Index from a Collection:
```mongodb ```mongodb
db.Employee.dropIndexes() db.Employee.dropIndexes()
``` ```