View sql_window_functions_01.sql
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
/* Sample data */ | |
insert into emp (EMPID, NAME, JOB, SALARY) | |
values | |
(201, 'ANIRUDDHA', 'ANALYST', 2100), | |
(212, 'LAKSHAY', 'DATA ENGINEER', 2700), | |
(209, 'SIDDHARTH', 'DATA ENGINEER', 3000), | |
(232, 'ABHIRAJ', 'DATA SCIENTIST', 2500), | |
(205, 'RAM', 'ANALYST', 2500), | |
(222, 'PRANAV', 'MANAGER', 4500), | |
(202, 'SUNIL', 'MANAGER', 4800), |
View mongo_stats_12.py
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
# Query stats | |
pprint(db.restaurants.find({'cuisine':'French','grades.score':{'$gt':5}}).explain()['executionStats']) |
View mongo_stats_11.py
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
# Query stats | |
pprint(db.restaurants.find({'cuisine':'American'}).explain()['executionStats']) |
View mongo_stats_10.py
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
pprint(db.restaurants.find().explain()) |
View mongo_index_17.py
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
# Multiple token search | |
db.restaurants.find_one({"$text": {"$search": "Chinese -Restaurant"}}) |
View mongo_index_16.py
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
# Multiple token search | |
db.restaurants.find_one({"$text": {"$search": "Chinese Kitchen"}}) |
View mongo_index_15.py
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
# Find restaurants with Kitchen in their name | |
db.restaurants.find_one({"$text": {"$search": "Kitchen"}}) |
View mongo_index_14.py
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
# Drop indexes | |
db.restaurants.drop_indexes() | |
# Create text index | |
db.restaurants.create_index([('name', 'text')], | |
name='restaurant_name') | |
# List indexes | |
pprint(db.restaurants.index_information()) |
View mongo_stats_9.py
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
# Query stats | |
pprint(db.restaurants.find({'cuisine':'French'}).explain()['executionStats']) |
View mongo_stats_8.py
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
# Query stats | |
pprint(db.restaurants.find({'cuisine':'French','grades.score':{'$gt':2}}).explain()['executionStats']) |
NewerOlder