- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6702 Articles for Database
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
76 Views
To evaluate one or more values, use $or along with find(). Let us create a collection with documents −> db.demo174.insertOne({"StudentName":"Chris", "CountryName":"US"}); { "acknowledged" : true, "insertedId" : ObjectId("5e383c709e4f06af551997e5") } > db.demo174.insertOne({"StudentName":"David", "CountryName":"UK"}); { "acknowledged" : true, "insertedId" : ObjectId("5e383c779e4f06af551997e6") } > db.demo174.insertOne({"StudentName":"Bob", "CountryName":"AUS"}); { "acknowledged" : true, "insertedId" : ObjectId("5e383c7e9e4f06af551997e7") }Display all documents from a collection with the help of find() method −> db.demo174.find();This will produce the following output −{ "_id" : ObjectId("5e383c709e4f06af551997e5"), "StudentName" : "Chris", "CountryName" : "US" } { "_id" : ObjectId("5e383c779e4f06af551997e6"), "StudentName" : "David", "CountryName" : "UK" } { "_id" : ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
128 Views
To limit the number of values in a field, use MongoDB $slice. Let us create a collection with documents −> db.demo173.insertOne({"ListOfValues":[10, 40, 100, 560, 700, 900]}); { "acknowledged" : true, "insertedId" : ObjectId("5e383a4f9e4f06af551997e4") }Display all documents from a collection with the help of find() method −> db.demo173.find().pretty();This will produce the following output −{ "_id" : ObjectId("5e383a4f9e4f06af551997e4"), "ListOfValues" : [10, 40, 100, 560, 700, 900 ] }Following is the query to limit number of values in a field using MongoDB −> db.demo173.find({}, { "ListOfValues": { "$slice": -2 } } );This will produce the following output −{ "_id" ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
To find a value in lowercase, use the toLowerCase() method in MongoDB. Use the method in find() to find the value in lowercase.Let us create a collection with documents −> db.demo172.insertOne({"SubjectName":"MySQL"}); { "acknowledged" : true, "insertedId" : ObjectId("5e3838ce9e4f06af551997e1") } > db.demo172.insertOne({"SubjectName":"mongodb"}); { "acknowledged" : true, "insertedId" : ObjectId("5e3838d69e4f06af551997e2") } > db.demo172.insertOne({"SubjectName":"MongoDB"}); { "acknowledged" : true, "insertedId" : ObjectId("5e3838db9e4f06af551997e3") }Display all documents from a collection with the help of find() method −> db.demo172.find();This will produce the following output −{ "_id" : ObjectId("5e3838ce9e4f06af551997e1"), "SubjectName" : "MySQL" } { "_id" : ObjectId("5e3838d69e4f06af551997e2"), "SubjectName" : "mongodb" } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
209 Views
To re-map the fields of a MongoDB collection, use update() along with $rename. Let us first create a collection with documents −> db.demo171.insertOne( { "Name": "Chris", "Details": { "SubjectName": "MySQL", "CountryName": "US" } } ); { "acknowledged" : true, "insertedId" : ObjectId("5e3837 399e4f06af551997e0") }Display all documents from a collection with the help of find() method −> db.demo171.find();This will produce the following output −{ "_id" : ObjectId("5e3837399e4f06af551997e0"), "Name" : "Chris", "Details" : { "SubjectName" : "MySQL", "CountryName" : "US" } }Following is the query to re-map the fields of a MongoDB collection −> db.demo171.update({}, { $rename : { 'Name' ... Read More
![Narendra Kumar](https://www.tutorialspoint.com/articles/images/user_icon.png)
1K+ Views
Problem statementMean is the average of the given data set calculated by dividing the total sum by the number of values in the data set.Mode of a data set is the value that appears most frequently in a series of dataIf our dataset is {1, 2, 3, 4} then mean value is − (1 + 2 + 3 + 4) / 4 = 2.5If our dataset is {1, 2, 3, 4, 1, 1, 1, 1} then mode value is − 1 as it appears 5 times.ExampleFirst, create a table −CREATE TABLE NUMBERS ( value INT )Insert data into the ... Read More
![Pradeep Elance](https://www.tutorialspoint.com/assets/profiles/121076/profile/60_44312-1565945237.jpg)
221 Views
Mysql is one of the most widely used open source Dbs. Python provides ways to connect to this DB and use the DB to store and retrive the data from it.Install pymysqlDepending on the python environment you are using, pymysql package can be installed using one of the following methods.# From python console pip install pymysql #Using Anaconda conda install -c anaconda pymysql # Add modules using any python IDE pymysqlConnecting to MySqlNow we can connect to the Mysql environment using the following code. After connecting we are finding out the version of the DB.Exampleimport pymysql # Open database connection ... Read More
![sudhir sharma](https://www.tutorialspoint.com/assets/profiles/125719/profile/60_65058-1565947418.jpg)
11K+ Views
Primary KeyPrimary Key is a column that is used to uniquely identify each tuple of the table.It is used to add integrity constraints to the table. Only one primary key is allowed to be used in a table. Duplicate and NULL (empty) values are not valid in the case of the primary key. Primary keys can be used as foreign keys for other tables too.Let’s take an example, We have a table name employee which stores data of employees of a company. The below table shows the contents of the table.Emp_idNamePh_No.PositionSalaryEmp_id here is primary key of the table. As the ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
369 Views
When it comes to two of the most talked about technologies in present times, Big Data and Internet of Things (IoT) are perhaps right at the helm. And over the last few years, Big Data has made progress in numerous domains. And although Internet of Things happens to be different, it is massively linked to Big Data.What is Big Data?Big Data is essentially a large amount of data that is in complex form. Specifically, it also refers to the use of predictive analysis and methods that allows extraction of valuable information from such data. This allows better decision making, reduction ... Read More
![Kiran Kumar Panigrahi](https://www.tutorialspoint.com/assets/profiles/390736/profile/60_2598-1635242143.png)
8K+ Views
A data warehouse is a repository for structured, filtered data that has already been processed for a specific purpose. It collects the data from multiple sources and transforms the data using ETL process, then loads it to the Data Warehouse for business purpose. An operational database, on the other hand, is a database where the data changes frequently. They are mainly designed for high volume of data transaction. They are the source database for the data warehouse. Operational databases are used for recording online transactions and maintaining integrity in multi-access environments. Read this article to learn more about data warehouses ... Read More
![Kiran Kumar Panigrahi](https://www.tutorialspoint.com/assets/profiles/390736/profile/60_2598-1635242143.png)
672 Views
Data Lake and Data Warehouse both are used for storing big data. A Data Lake is a very big storage repository which is used to store raw unstructured data, machine to machine, logs flowing through in real-time. The purpose of the stored data is not defined in a data lake. They are stored for future analysis of the data. A data warehouse is a repository for structured, filtered data that has already been processed for a specific purpose. A Data warehouse collects the data from multiple sources and transforms the data using ETL process, then loads it to the Data ... Read More