- 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)
765 Views
MongoDB insertOne() inserts a document into a collection, whereas updateOne() update a single document in a collection based on a query filter.Let us create a collection with documents −> db.demo735.insertOne({id:1, Name:"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5ead51b657bb72a10bcf0652") } > db.demo735.insertOne({id:1, Name:"David"}); { "acknowledged" : true, "insertedId" : ObjectId("5ead51bb57bb72a10bcf0653") } > db.demo735.insertOne({id:1, Name:"Bob"}); { "acknowledged" : true, "insertedId" : ObjectId("5ead51be57bb72a10bcf0654") } > db.demo735.insertOne({id:1, Name:"Carol"}); { "acknowledged" : true, "insertedId" : ObjectId("5ead51c757bb72a10bcf0655") }Display all documents from a collection with the help of find() method −> db.demo735.find();This will produce the following output −{ "_id" ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
1K+ Views
To get the difference between dates in MongpDB, use aggregate(). Let us create a collection with documents −> db.demo734.insertOne({GivenDate:new ISODate("2020-01-10")}); { "acknowledged" : true, "insertedId" : ObjectId("5ead4f1a57bb72a10bcf064e") } > db.demo734.insertOne({GivenDate:new ISODate("2020-02-20")}); { "acknowledged" : true, "insertedId" : ObjectId("5ead4f2157bb72a10bcf064f") } > db.demo734.insertOne({GivenDate:new ISODate("2010-12-01")}); { "acknowledged" : true, "insertedId" : ObjectId("5ead4f2b57bb72a10bcf0650") } > db.demo734.insertOne({GivenDate:new ISODate("2020-05-01")}); { "acknowledged" : true, "insertedId" : ObjectId("5ead506f57bb72a10bcf0651") }Display all documents from a collection with the help of find() method −> db.demo734.find();This will produce the following output −{ "_id" : ObjectId("5ead4f1a57bb72a10bcf064e"), "GivenDate" : ISODate("2020-01-10T00:00:00Z") } { "_id" : ObjectId("5ead4f2157bb72a10bcf064f"), "GivenDate" ... Read More
![Nitin Sharma](https://www.tutorialspoint.com/assets/profiles/134888/profile/60_107635-1568620292.jpg)
2K+ Views
Before discussing on Simple and complex, first we should know what is View. A View is the logical virtual table created from one or more tables which can be primarily used to fetch the columns from one or more different tables at a time. On the basis of tables involved in the view we can distinguish between Simple and Complex View in SQL.Following are the important differences between Simple and Complex View.Sr. No.KeySimple ViewComplex View1DefinitionSimple View in SQL is the view created by involving only single table. In other words we can say that there is only one base table ... Read More
![Kiran Kumar Panigrahi](https://www.tutorialspoint.com/assets/profiles/390736/profile/60_2598-1635242143.png)
54K+ Views
The main constituent of any database is its tables, in order to make data accessibility custom there is concept of Views in other words we can say that with the help of Views of a table we can restrict any user to access only that data which is supposed to be accessed by him. Now on the basis of characteristic and features of the views we can distinguish between Views and Materialized Views. In this article, we will discuss the important differences between Views and Materialized Views in SQL. But before, let’s have look into the basics of views and ... Read More
![Kiran Kumar Panigrahi](https://www.tutorialspoint.com/assets/profiles/390736/profile/60_2598-1635242143.png)
2K+ Views
Hive and HBase are Hadoop-based Big Data solutions. These technologies serve different purposes in almost any real use scenario. When you log onto Facebook, you may see your friend's list, a news feed, ad suggestions, friend suggestions, etc. Twitter is similar.Apache Hadoop, along with other technologies we'll explore today, such as Apache Hive vs. Apache HBase, is how Facebook loads all of its messy data in a presentable manner. Apache Hadoop enables Facebook's two billion-plus daily users.Because Big Data systems are complicated, all technologies must be used together. Hive is recommended for analyzing time-series data. It can evaluate trends and ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
2K+ Views
We are given a string of any length and the task is to calculate the count of characters and words in a string using PL/SQL.PL/SQL is a combination of SQL along with the procedural features of programming languages.It was developed by Oracle Corporation in the early 90's to enhance the capabilities of SQL. PL/SQL is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java.In PL/SQL block, we have DECLARE block which is used to declare the variables used in programming and we have BEGIN block where we write the logic for the ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
923 Views
Use $replaceRoot in MongoDB aggregation. The $replaceRoot replaces the input document with the specified document. The operation replaces all existing fields in the input document, including the _id field. Let us create a collection with documents −> db.demo733.insertOne( ... { ... "SubjectDetails": ... [ ... { ... SubjectName:"MongoDB", ... "Marks":85 ... }, ... { ... SubjectName:"MySQL", ... ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
403 Views
You can use $set. Let us create a collection with documents −> db.demo732.insertOne({_id:1, Language:"English"}); { "acknowledged" : true, "insertedId" : 1 } > db.demo732.insertOne({_id:2, Language:"Hindi"}); { "acknowledged" : true, "insertedId" : 2 }Display all documents from a collection with the help of find() method −> db.demo732.find();This will produce the following output −{ "_id" : 1, "Language" : "English" } { "_id" : 2, "Language" : "Hindi" }Following is the query to add a field with specific datatype (list, object) in an existing MongoDB document −> db.demo732.update({_id:1}, ... { $set:{details:{'subjectName':"MongoDB"}, studentDetails:[{Name:"David"}, {CountryName:"US"}]}}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
742 Views
To display a specific field, use $project along with $unwind. To ignore a field, set to 0. Let us create a collection with documents −> db.demo731.insertOne({ "ProductInformation": [ { ProductId:"Product-1", ProductPrice:80 }, { ProductId:"Product-2", ProductPrice:45 }, { ProductId:"Product-3", ProductPrice:50 } ] } ); { "acknowledged" : true, "insertedId" : ObjectId("5eac5efd56e85a39df5f6341") }Display all documents from a collection with the help of find() method −> db.demo731.find();This will produce the following output −{ "_id" : ObjectId("5eac5efd56e85a39df5f6341"), "ProductInformation" : [ { "ProductId" : "Product-1", "ProductPrice" : 80 }, { "ProductId" : "Product-2", "ProductPrice" : 45 }, { "ProductId" : "Product-3", "ProductPrice" : ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
412 Views
To match, use $match in MongoDB. For values greater than a specific number, use $gt. Let us create a collection with documents −> db.demo730.insertOne({"Name" : "Chris", "Marks" : 33 }); { "acknowledged" : true, "insertedId" : ObjectId("5eac54cd56e85a39df5f6339") } > db.demo730.insertOne({ "Name" : "David", "Marks" : 89}); { "acknowledged" : true, "insertedId" : ObjectId("5eac54cd56e85a39df5f633a") } > db.demo730.insertOne({ "Name" : "Chris", "Marks" : 45 }); { "acknowledged" : true, "insertedId" : ObjectId("5eac54ce56e85a39df5f633b") }Display all documents from a collection with the help of find() method −> db.demo730.find();This will produce the following output −{ "_id" : ObjectId("5eac54cd56e85a39df5f6339"), "Name" ... Read More