
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Smita Kapse has Published 498 Articles

Smita Kapse
333 Views
For this, use $elemMatch operator. Let us first create a collection with documents −> db.findDocumentsHaving2Demo.insertOne( {_id : 101, Values: [78, 98]} ); { "acknowledged" : true, "insertedId" : 101 } > db.findDocumentsHaving2Demo.insertOne( {_id :102, Values : [89, 102]} ); { "acknowledged" : true, "insertedId" : 102 }Following is ... Read More

Smita Kapse
144 Views
For array concatenation, use $concatArrays operator. Let us first create a collection with documents −>db.arrayConcatenationDemo.insertOne({"TeacherName":["Chris", "Robert"], "StudentName":["Mike", "Sam"]}); { "acknowledged" : true, "insertedId" : ObjectId("5ce921c078f00858fb12e911") }Following is the query to display all documents from a collection with the help of find() method −> db.arrayConcatenationDemo.find().pretty();This will produce the following ... Read More

Smita Kapse
98 Views
The variable table_type doesn’t work since this variable is deprecated as of MySQL 5.5.3. Use default_storage_engine instead. Following is the syntax −SET default_storage_engine = yourTableEngine;The table engine name may be InnoDB or MyISAM. Here, we will set engine type to MyISAM −mysql> SET default_storage_engine=MyISAM; Query OK, 0 rows affected (0.00 sec)Let us create a table.mysql> create ... Read More

Smita Kapse
482 Views
To remove empty fields, use deleteMany(). Let us first create a collection with documents −> db.removeEmptyFieldsDemo.insertOne({"StudentName":""}); { "acknowledged" : true, "insertedId" : ObjectId("5ce92b9578f00858fb12e919") } > db.removeEmptyFieldsDemo.insertOne({"StudentName":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5ce92b9878f00858fb12e91a") } > db.removeEmptyFieldsDemo.insertOne({"StudentName":""}); { "acknowledged" : true, "insertedId" : ObjectId("5ce92b9c78f00858fb12e91b") } ... Read More

Smita Kapse
862 Views
For using MySQL CASE statement while using UPDATE Query, you can use CASE statement. Let us first create a table −mysql> create table DemoTable ( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserScore int ); Query OK, 0 rows affected (0.29 sec)Insert some records in the table ... Read More

Smita Kapse
137 Views
To retrieve array values, use dot(.) notation. Let us first create a collection with documents −> db.retrievingArrayDemo.insertOne( { "UserDetails" : [ { "UserName" : "John", "UserAge" : 23 } ], "UserCountryName" : "AUS", "UserLoginDate" : new ISODate(), "UserMessage" : "Hello" } ); { "acknowledged" : true, "insertedId" : ObjectId("5ce9718478f00858fb12e920") } > db.retrievingArrayDemo.insertOne( { "UserDetails" : [ ... Read More

Smita Kapse
218 Views
Use aggregate function SUM() to get the sum of a column in al rows. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Amount int ); Query OK, 0 rows affected (0.20 sec)Insert some records in the table ... Read More

Smita Kapse
347 Views
When you’re on a call, you can hang up the phone by pressing the Side button on your iOS device. This button is also called as sleep/wake up or lock button.The devices and iOS are specifically designed the way that pressing the power button while on a call will immediately ... Read More

Smita Kapse
487 Views
Use $avg operator along with aggregate framework. Let us first create a collection with documents. Here, one of the fields is StudentScore −> db.averageReturiningNullDemo.insertOne( {"StudentDetails" : { "StudentScore" : 89 } }); { "acknowledged" : true, "insertedId" : ObjectId("5ce9822e78f00858fb12e927") } > db.averageReturiningNullDemo.insertOne( {"StudentDetails" : { "StudentScore" ... Read More

Smita Kapse
269 Views
You need to give name explicitly or you can remove AS command. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(20) ); Query OK, 0 rows affected (0.21 sec)Insert some records in the table using ... Read More