Created
December 6, 2022 22:18
-
-
Save parkerfoshay/76248f9c7ab432eb260070b65718e3c4 to your computer and use it in GitHub Desktop.
between order by and limit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.zips.find( | |
{ state: "NY", pop: { $gte: 1000, $lte: 5000 }}, | |
{_id: 0, state: 1, city: 1, pop: 1} | |
).sort({pop: -1}) | |
.limit(10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT city, state, pop | |
FROM zips | |
WHERE state = 'NY' AND pop BETWEEN 1000 AND 5000 | |
ORDER BY pop DESC | |
LIMIT 10; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment