Made minor changes to queries to show output.

This commit is contained in:
K 2024-10-17 20:18:19 +05:30
parent fed7e0adb1
commit 34a507522a
Signed by: notkshitij
GPG Key ID: C5B8BC7530F8F43F

View File

@ -6,7 +6,7 @@
> 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 20000:
```mongodb
db.Employee.aggregate([
{
@ -17,18 +17,18 @@ db.Employee.aggregate([
},
{
$match: {
TotalSalary: { $gt: 200000 }
TotalSalary: { $gt: 20000 }
}
}
])
```
2. Find Employee with Total Salary for Each City with Designation "DBA":
2. Find Employee with Total Salary for Each City with Designation "Developer":
```mongodb
db.Employee.aggregate([
{
$match: { Designation: "DBA" }
$match: { Designation: "Tester" }
},
{
$group: {
@ -40,11 +40,11 @@ db.Employee.aggregate([
```
3. Find Total Salary of Employee with Designation "DBA" for Each Company:
3. Find Total Salary of Employee with Designation "Tester" for Each Company:
```mongodb
db.Employee.aggregate([
{
$match: { Designation: "DBA" }
$match: { Designation: "Tester" }
},
{
$group: {
@ -94,11 +94,11 @@ db.Employee.aggregate([
```
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 "Aditya":
```mongodb
db.Employee.aggregate([
{
$match: { "Name.FName": "Swapnil" }
$match: { "Name.FName": "Aditya" }
},
{
$unwind: "$Expertise"
@ -192,7 +192,7 @@ db.Employee.reIndex()
6. Drop Index on Remove Specific Index:
```mongodb
db.Employee.dropIndex("empIndex")
db.Employee.dropIndex("Designation_1")
```