
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
190 Views
Yes, for this, use $indexOfCP operator along with aggregate framework. Let us first create a collection with documents −> db.patterDemo.insertOne( { "ClientName": "John", "ClientWebsiteName":"webbuziness.com/John/business" } ); { "acknowledged" : true, "insertedId" : ObjectId("5cea40acef71edecf6a1f68d") } > db.patterDemo.insertOne( { "ClientName": "Carol", ... Read More

Smita Kapse
122 Views
The DROP TABLE removes the table completely and also removes all data. If you want to remove all data completely and wants the table structure, then you can use TRUNCATE TABLE command. The TRUNCATE command will recreate the table.Let us first check the DROP TABLE. For that, we will first ... Read More

Smita Kapse
308 Views
To retrieve an embedded object as a document, use the aggregation $replaceRoot. Let us first create a collection with documents −> db.embeddedObjectDemo.insertOne( { _id: new ObjectId(), "UserDetails": { "UserName": "John", "UserAge": 24, "UserEmailId": "John22@gmail.com" } } ); { "acknowledged" : true, "insertedId" : ... Read More

Smita Kapse
625 Views
To extract the particular element in MongoDB, you can use $elemMatch operator. Let us first create a collection with documents −> db.particularElementDemo.insertOne( { "GroupId" :"Group-1", "UserDetails" : [ { "UserName" : "John", ... Read More

Smita Kapse
225 Views
You can use ORDER BY for this. Let us first create a table −mysql> create table DemoTable ( Value int ); Query OK, 0 rows affected (0.20 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(20); Query OK, 1 row affected (0.07 ... Read More

Smita Kapse
205 Views
Use $addToSet operator to ensures that there are no duplicate items added to the set. Let us first create a collection with documents −> db.getDistinctDemo.insertOne({"Values":[100, 200]}); { "acknowledged" : true, "insertedId" : ObjectId("5cef69f9ef71edecf6a1f69d") } > db.getDistinctDemo.insertOne({"Values":[300, 100]}); { "acknowledged" : true, "insertedId" : ObjectId("5cef6a07ef71edecf6a1f69e") }Display all ... Read More

Smita Kapse
174 Views
You can use ORDER BY RIGHT() for this. Let us first create a table −mysql> create table DemoTable ( UserId varchar(100) ); Query OK, 0 rows affected (0.33 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('User1234'); Query OK, 1 row affected ... Read More

Smita Kapse
194 Views
Let us first create a collection with documents −> db.queryMongoValueDemo.insertOne( { _id:101, "ScoreDetails":[{Score:80}, {Score:45}, {Score:25}, {Score:70}] } ); { "acknowledged" : true, "insertedId" : 101 } > db.queryMongoValueDemo.insertOne( { _id:102, "ScoreDetails":[{Score:80}, {Score:24}, {Score:34}] } ... Read More

Smita Kapse
67 Views
The getMaxColumnsInGroupBy() method of the DatabaseMetaData interface is used to find out the maximum number of columns that the underlying database allows in a GROUP BY clause.This method returns an integer value, representing the maximum number of columns allowed in a GROUP BY clause. If this value is 0 it ... Read More

Smita Kapse
757 Views
You can use GROUP_CONCAT() function from MySQL to display result as a comma separated list. Let us first create a table −mysql> create table DemoTable ( Value int ); Query OK, 0 rows affected (0.26 sec)Insert some records in the table using insert command −mysql> insert into ... Read More