Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BCN - FT - Ale DLM #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added data/.DS_Store
Binary file not shown.
Binary file removed data/Crunchbase Dataset.zip
Binary file not shown.
18,801 changes: 18,801 additions & 0 deletions data/companies 2.json

Large diffs are not rendered by default.

18,801 changes: 18,801 additions & 0 deletions data/companies.json

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,80 @@

### 1. All the companies that it's name match 'Babelgum'. Retrieve only their `name` field.

<!-- Your Code Goes Here -->
db.companies.find({name: "Babelgum"},{name:1, _id:0})

### 2. All the companies that have more than 5000 employees. Limit the search to 20 companies and sort them by **number of employees**.

<!-- Your Code Goes Here -->
db.companies.find({number_of_employees:{$gt:5000}}).limit(20).sort({number_of_employees: 1})

### 3. All the companies founded between 2000 and 2005, both years included. Retrieve only the `name` and `founded_year` fileds.

<!-- Your Code Goes Here -->
db.companies.find({founded_year:{$gte:2000, $lte:2005}}, {name: 1, founded_year: 1, _id:0}).pretty()

### 4. All the companies that had a Valuation Amount of more than 100.000.000 and have been founded before 2010. Retrieve only the `name` and `ipo` fields.

<!-- Your Code Goes Here -->
db.companies.find({$and: [{founded_year:{$lt:2000}}, {"ipo.valuation_amount": {$gt: 100000000}}]}, {name: 1, ipo: 1, _id:0}).pretty()

### 5. All the companies that have less than 1000 employees and have been founded before 2005. Order them by the number of employees and limit the search to 10 companies.

<!-- Your Code Goes Here -->
db.companies.find({$and: [{founded_year:{$lt:2005}}, {"number_of_employees": {$lt: 1000}}]}).limit(10).sort({number_of_employees: 1}).pretty()

### 6. All the companies that don't include the `partners` field.

<!-- Your Code Goes Here -->
db.companies.find( { partners: { $exists: false } } )

### 7. All the companies that have a null type of value on the `category_code` field.

<!-- Your Code Goes Here -->
db.companies.find( { category_code: null } ).pretty()

### 8. All the companies that have at least 100 employees but less than 1000. Retrieve only the `name` and `number of employees` fields.

<!-- Your Code Goes Here -->
db.companies.find({$and: [{number_of_employees:{$lt:1000}}, {number_of_employees: {$gt: 100}}]}, {name: 1, number_of_employees: 1, _id:0}).pretty()

### 9. Order all the companies by their IPO price descendently.

<!-- Your Code Goes Here -->
db.companies.find().sort({"ipo.valuation_amount":-1}).pretty()

### 10. Retrieve the 10 companies with more employees, order by the `number of employees`

<!-- Your Code Goes Here -->
db.companies.find().sort({"number_of_employees":-1}).limit(10).pretty()

### 11. All the companies founded on the second semester of the year. Limit your search to 1000 companies.

<!-- Your Code Goes Here -->
db.companies.find({founded_month: {$gte: 7}}).limit(10).pretty()

### 12. All the companies that have been 'deadpooled' after the third year.

<!-- Your Code Goes Here -->
db.companies.find({deadpooled_year: {$gte: 3}}).limit(10).pretty()

### 13. All the companies founded before 2000 that have and acquisition amount of more than 10.000.000

<!-- Your Code Goes Here -->
db.companies.find({$and: [{founded_year:{$lt:2000}}, {"acquisition.price_amount": {$gt: 10000000}}]}).pretty()

### 14. All the companies that have been acquired after 2015, order by the acquisition amount, and retrieve only their `name` and `acquisiton` field.

<!-- Your Code Goes Here -->
db.companies.find({"acquisition.acquired_year": {$gt: 2015}},{name: 1, acquisition:1, _id:0}).sort({"acquisition.price_amount":-1}).pretty()

### 15. Order the companies by their `founded year`, retrieving only their `name` and `founded year`.

<!-- Your Code Goes Here -->
db.companies.find({},{name: 1, founded_year:1, _id:0}).sort({founded_year:1}).pretty()

### 16. All the companies that have been founded on the first seven days of the month, including the seventh. Sort them by their `aquisition price` descendently. Limit the search to 10 documents.

<!-- Your Code Goes Here -->
db.companies.find({"founded_day": {$lte: 7}}).sort({"acquisition.price_amount":-1}).limit(10).pretty()

### 17. All the companies on the 'web' `category` that have more than 4000 employees. Sort them by the amount of employees in ascendant order.

<!-- Your Code Goes Here -->
db.companies.find({$and: [{category_code:"web"}, {"number_of_employees": {$gt: 4000}}]}).limit(10).sort({number_of_employees: 1}).pretty()

### 18. All the companies which their acquisition amount is more than 10.000.000, and currency are 'EUR'.

<!-- Your Code Goes Here -->
db.companies.find({$and: [{"acquisition.price_currency_code":"EUR"}, {"acquisition.price_amount": {$gt: 10000000}}]}).limit(10).pretty()

### 19. All the companies that have been acquired on the first trimester of the year. Limit the search to 10 companies, and retrieve only their `name` and `acquisition` fields.

<!-- Your Code Goes Here -->
db.companies.find({"acquisition.acquired_month": {$lt: 3}},{name: 1, acquisition:1, _id:0}).limit(10).pretty()

### 20. All the companies that have been founded between 2000 and 2010, but have not been acquired before 2011.

<!-- Your Code Goes Here -->
db.companies.find({$and: [{founded_year:{$gt:2000}}, {founded_year: {$lt: 2010}}, {"acquisition.acquired_year":{$lte: 2011}}]}).pretty()