AmitDiwan has Published 10744 Articles

MySQL regular expression to update a table with column values including string, numbers and special characters

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:26:18

750 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

MongoDB query to aggregate nested array

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:25:14

1K+ Views

To aggregate nested array in MongoDB, use aggregate(). Let us create a collection with documents −> db.demo441.insertOne( ...    { ... ...       "Name" : "David", ...       "Age" : 21, ... ...       "details" : [ ...          { ... ... Read More

How do I insert multiple values in a column with a single MySQL query?

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:24:43

2K+ Views

To insert multiple values in a column, the syntax is as follows −insert into yourTableName values(yourValue1), (yourValue2), ..........N;To understand the above syntax, let us create a table −mysql> create table DemoTable2022    -> (    -> Department varchar(100)    -> ); Query OK, 0 rows affected (0.49 sec)Insert some records ... Read More

Insert data from one schema to another in MySQL?

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:20:37

1K+ Views

To insert data from one scheme to another, the syntax is as follows. Here, we have two databases “yourDatabaseName1” and “yourDatabaseName2” −insert into yourDatabaseName2.yourTableName2 select *from yourDatabaseName1.yourTableName1;To understand the above syntax, let us create a table. We are creating a table in database “web” −mysql> create table DemoTable2020    -> ... Read More

How to count items in array with MongoDB?

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:17:15

283 Views

To count items in array, use length. Let us create a collection with documents −> db.demo440.insertOne( ...    { ...       "Name":"Chris", ...       "ListOfFriends":["John", "Sam", "Mike"] ...    } ... ); {    "acknowledged" : true,    "insertedId" : ObjectId("5e78c63cbbc41e36cc3caeb5") } > > db.demo440.insertOne( ... ... Read More

How to create a blurry background image with CSS?

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:14:23

907 Views

Following is the code to create a blurry background image with CSS −Example Live Demo body, html {    height: 100vh;    margin: 0;    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } * {    box-sizing: border-box; } .backgroundImage {    background-image: url("https://images.pexels.com/photos/1172207/pexels-photo-1172207.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500");    filter: blur(10px); ... Read More

Project field in MongoDB

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:14:17

221 Views

To project field in MongoDB, use $project. Let us create a collection with documents −> db.demo439.insertOne( ...    { ...       "Name" : "Chris", ...       "MarksInformation" : { ...          "Marks1" : 67, ...          "Marks2" :45, ...   ... Read More

MySQL: update field with Group By?

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:12:36

875 Views

To update field with GROUP BY, use ORDER BY LIMIT with UPDATE command −mysql> create table DemoTable2018    -> (    -> EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> EmployeeName varchar(20),    -> EmployeeSalary int    -> ); Query OK, 0 rows affected (0.61 sec)Insert some records in ... Read More

How to create a Hero Image with CSS?

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:10:58

415 Views

Following is the code to create a hero image with CSS −Example Live Demo body, html {    height: 100%;    margin: 0;    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } *, *::before, *::after {    box-sizing: border-box; } h1 {    font-size: 60px;    font-weight: ... Read More

How to remove duplicate record in MongoDB 3.x?

AmitDiwan

AmitDiwan

Updated on 06-Apr-2020 13:08:14

350 Views

To remove duplicate record, use aggregate(). Let us create a collection with documents −> db.demo438.insertOne({"FirstName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e775c37bbc41e36cc3caea1") } > db.demo438.insertOne({"FirstName":"David"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e775c3dbbc41e36cc3caea2") } > db.demo438.insertOne({"FirstName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5e775c40bbc41e36cc3caea3") } > ... Read More

Advertisements