Answer to Question #144118 in Databases | SQL | Oracle | MS Access for jerry

Question #144118
Use the methods find() and pretty() to implement the following queries.

(9) Display in a pretty format the names of drivers who performed no trips so far.
(10) Display in a pretty format names of drivers who started at least on trip in
Wollongong.

Need help for part 9 and 10
1
Expert's answer
2020-11-13T13:24:22-0500

9 )  Display in a pretty format the names of drivers who performed no trips so far.

//Query to print all the name of employes who performed no trip so far
db.employee.find({"Trip": {$exists:true, $size:0}},{"name":1}).pretty()

10) Display in a pretty format names of drivers who started at least on trip in Wollongong.

db.employee.aggregate([
    {$match: {'Trip.TripLEG.ciytname': 'Wollongong'}},
    {$project: {
        Trip: {$filter: {
            input: '$Trip',
            as: 'TripLEG',
            cond: {$eq: ['$$TripLEG.ciytname', 'Wollongong']}
        }},
        _id: 0,
    }}
])

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS