Question

In: Computer Science

covert to MongoDB NoSQL a. In 1990, in what games and what Seattle players had interceptions...

covert to MongoDB NoSQL

a. In 1990, in what games and what Seattle players had interceptions in a game?

Select games.game_number, profiles.name from games, profiles where games.defense_interceptions <>0 and games.team=”SEA” and games.year=”1990” and games.player_id = profiles.player_id;

b. For each year played, list a count of games in which John David Crow played.

select year, count(*) from profiles natural join games where name=”John David Crow” group by year;

Solutions

Expert Solution

a.

db.games,profiles .find({

   "$and": [{
       "games.defense_interceptions <":{ "$gt" : 0 }
   },{
   "$and": [{
       "$where": "this. games.team == this.”SEA” "
   },{
   "$and": [{
       " games.year" : ”1990”
   },{   "$where": "this. games.player_id == this. profiles.player_id"
   }]
   }]
   }]
},{
   "games.game_number": 1,
   "profiles.name": 1
}
);

b.

db.profilesnatural join games .group({

"key":{
"year": true
},
"initial": {
"countstar":0
},
"reduce": function( obj , prev ){

if (true != null ) if ( true instanceof Array)prev.countstar += true.length;
else prev.countstar++;

},
"finalize": function( prev ){

},
"cond": {
   "$where": "this.name == this.”John David Crow” "
}

});


Related Solutions

Compare the Data Modeling difference between relational database and NoSQL MongoDB.
Compare the Data Modeling difference between relational database and NoSQL MongoDB.
1. What is the NoSQL movement?
1. What is the NoSQL movement?
what is the extended definition of MongoDB, Cassandra, influxdb, and neo4j?
what is the extended definition of MongoDB, Cassandra, influxdb, and neo4j?
In repeated games, players do not have the opportunity to build a reputation and to discover...
In repeated games, players do not have the opportunity to build a reputation and to discover more about the opponent. True False
What is behaviour? Give examples of overt and covert behaviour.
What is behaviour? Give examples of overt and covert behaviour.
5. Consider the following games played between two players, A and B.   Game 1: A and...
5. Consider the following games played between two players, A and B.   Game 1: A and B have reached a verbal agreement: A would deliver a case of beer to B, and B would deliver a bag of beer nuts to A. Now, each player needs to take an action: keep the promise (to deliver the goods), break the promise. If both keep their promises, then each player gets a payoff of 5; if both break their promises, then each...
Two towns had a population of 12,000 in 1990. By 2000, the population of town A...
Two towns had a population of 12,000 in 1990. By 2000, the population of town A had increased by  13⁢ % while the population of town B had decreased by  13⁢ %. Assume these growth and decay rates continued. a. Write two exponential population models A(T) and B(T) for towns A and B, respectively, where T is the number of decades since 1990. A(T)= 12000*e0.12*T B(T)= 12000*e−0.14*T b. Write two new exponential models a(t) and b(t) for towns A and...
What is a covert channel and how is it useful to conceal pentest activity?
What is a covert channel and how is it useful to conceal pentest activity?
A bowling team consists of five players. Each player bowls three games. Write a program, in...
A bowling team consists of five players. Each player bowls three games. Write a program, in python, that uses a nested loop to enter each player’s name and individual scores (for three games). You will use one variable for the name and only one variable to enter the scores. Do not use score1, score2, and score3. Compute and display the bowler’s name and average score. Also, calculate and display the average team score. YOU MUST USE A NESTED LOOP FOR...
Compare the strengths and weaknesses of SQL and NoSQL Databases. 1. What´s the meaning of each...
Compare the strengths and weaknesses of SQL and NoSQL Databases. 1. What´s the meaning of each and how they work and store data. 2. In which scenarios is better to use one or the other. 3. What are the different types of SQL and NoSQL Databases. 4. What are the advantages of NoSQL over traditional SQL Databases. 5. When to use a NoSQL database instead of a relational database? 6. Which one is more scalable and flexible and in which...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT