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
AmitDiwan has Published 10740 Articles
AmitDiwan
498 Views
Let us first create a table −mysql> create table DemoTable2028 -> ( -> StudentFirstName varchar(20), -> StudentLastName varchar(20) -> ); Query OK, 0 rows affected (0.87 sec)Here is the query to create a stored procedure and insert values (using delimiter correctly) −mysql> delimiter // mysql> create ... Read More
AmitDiwan
201 Views
To push into an array with MongoDB, use $push. Let us create a collection with documents −> db.demo445.insertOne({"ListOfFriends":["Robert", "Mike", "Sam", "Carol", "David", "Mike"]}); { "acknowledged" : true, "insertedId" : ObjectId("5e78f099bbc41e36cc3caec2") }Display all documents from a collection with the help of find() method −> db.demo445.find().pretty();This will produce the following ... Read More
AmitDiwan
420 Views
Let us first create a table −mysql> create table DemoTable2027 -> ( -> UserId int -> ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2027 values(10); Query OK, 1 row affected (0.18 sec) mysql> insert ... Read More
AmitDiwan
219 Views
Yes, we can add minutes while inserting values in a table.Let us first create a table. Here, we have a column with VARCHAR records where inmysql> create table DemoTable2026 -> ( -> ArrivalTime varchar(20) -> ); Query OK, 0 rows affected (0.40 sec)Insert some records in the ... Read More
AmitDiwan
194 Views
For this, use $elemMatch, which is used to query nested objects. Let us create a collection with documents −> db.demo444.insertOne( ... { ... "Information": [{ ... id:1, ... Name:"Chris" ... }] ... } ... ... Read More
AmitDiwan
976 Views
The simplest way to replace records is using MySQL REPLACE() −mysql> create table DemoTable2025 -> ( -> URL text -> ); Query OK, 0 rows affected (0.88 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2025 values('http=//www.facebook.com'); Query OK, 1 row affected (0.23 ... Read More
AmitDiwan
269 Views
The following operations are treated as command operation in MongoDB −1.count 2.findAndModify 3.aggregateFollowing is the example of count in MongoDB −Let us create a collection with documents −> db.demo443.insertOne({"Name":"Chris"}); { "acknowledged" : true, "insertedId" : ObjectId("5e78d281bbc41e36cc3caeb9") } > db.demo443.insertOne({"Name":"Bob"}); { "acknowledged" : true, "insertedId" : ObjectId("5e78d285bbc41e36cc3caeba") ... Read More
AmitDiwan
925 Views
For this, use GROUP_CONCAT(). Let us first create a table −mysql> create table DemoTable2024 -> ( -> SubjectName varchar(20), -> StudentName varchar(20) -> ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2024 values('MySQL', 'Chris'); Query ... Read More
AmitDiwan
1K+ Views
To get distinct values from object array in MongoDB, use distinct(). Let us create a collection with documents −> db.demo442.insertOne( ... { ... ... "Information" : [ ... { ... "FirstName" : "John", ... ... Read More
AmitDiwan
784 Views
For this, use UPDATE command along with REGEXP. Let us first create a table −mysql> create table DemoTable2023 -> ( -> StreetNumber varchar(100) -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable2023 values('7'); Query OK, ... Read More