Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 67 of 81

Perform conditional upserts or updates in MongoDB

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 180 Views

For conditional upserts or updates, you can use $max operator. Let us first create a collection with documents>db.conditionalUpdatesDemo.insertOne({"_id":100, "StudentFirstScore":89, "StudentSecondScore":78, "BiggestScore":89}); { "acknowledged" : true, "insertedId" : 100 } >db.conditionalUpdatesDemo.insertOne({"_id":101, "StudentFirstScore":305, "StudentSecondScore":560, "BiggestScore":1050}); { "acknowledged" : true, "insertedId" : 101 } >db.conditionalUpdatesDemo.insertOne({"_id":103, "StudentFirstScore":560, "StudentSecondScore":789, "BiggestScore":880}); { "acknowledged" : true, "insertedId" : 103 } Following is the query to display all documents from a collection with the help of find() method: > db.conditionalUpdatesDemo.find().pretty();This will produce the following output{    "_id" : 100,    "StudentFirstScore" : 89,    "StudentSecondScore" : 78,    "BiggestScore" : 89 } {    "_id" : 101,   ...

Read More

Add to existing value in MySQL column using CONCAT function?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 951 Views

To understand the concept, let us first create a demo table.mysql> create table addToExistingValueDemo    -> (    -> Instructor_Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Instructor_Name varchar(30),    -> Instructor_TechnicalSubject text    -> ); Query OK, 0 rows affected (0.54 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into addToExistingValueDemo(Instructor_Name, Instructor_TechnicalSubject) values('John', 'C, C++'); Query OK, 1 row affected (0.15 sec) mysql> insert into addToExistingValueDemo(Instructor_Name, Instructor_TechnicalSubject) values('Carol', 'Java, Python'); Query OK, 1 row affected (0.18 sec) mysql> insert into addToExistingValueDemo(Instructor_Name, Instructor_TechnicalSubject) values('Bob', 'MySQL, SQL Server'); Query OK, 1 row ...

Read More

Decimal addition in 8085 Microprocessor

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 2K+ Views

In a digital computer, everything is represented using 0s and 1s only. For example, instruction will have a code using only 0s and 1s. Data is also represented using 0s and 1s. Data can be of different types like unsigned numbers, signed numbers, floating point numbers, binary coded decimal (BCD) numbers, etc. Thus, a series of 0s and 1s will acquire a value based on the interpretation. For decimal addition, we are having a very important and common instruction DAD. Let us discuss more on that instruction now.In spite of the fact that 8085 is an 8-bit microprocessor, but there ...

Read More

Is it possible to sum two fields in MongoDB using the Aggregation framework?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 1K+ Views

Yes, it is possible using the $project operator. Let us first create a collection with documents> db.sumTwoFieldsDemo.insertOne({"FirstValue":150, "SecondValue":350}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b4bfe15e86fd1496b38cd") } > db.sumTwoFieldsDemo.insertOne({"FirstValue":450, "SecondValue":1550}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b4c1215e86fd1496b38ce") } > db.sumTwoFieldsDemo.insertOne({"FirstValue":2560, "SecondValue":2440}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9b4c2715e86fd1496b38cf") }Following is the query to display all documents from a collection with the help of find() method> db.sumTwoFieldsDemo.find().pretty();This will produce the following output{    "_id" : ObjectId("5c9b4bfe15e86fd1496b38cd"),    "FirstValue" : 150,    "SecondValue" : 350 } {    "_id" : ObjectId("5c9b4c1215e86fd1496b38ce"),    "FirstValue" : 450,    "SecondValue" ...

Read More

Why does MySQL refuse pipe ('|') character in string on INSERT INTO?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 336 Views

To insert pipe(|) character in string on INSERT INTO, let us first see an example and create a table. The query to create a table is as followsmysql> create table PipeInsertDemo -> ( -> UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> UserPassword varchar(100) -> ); Query OK, 0 rows affected (0.52 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into PipeInsertDemo(UserPassword) values('John123|'); Query OK, 1 row affected (0.15 sec) mysql> insert into PipeInsertDemo(UserPassword) values('|123456CarolTaylor'); Query OK, 1 row affected ...

Read More

Program counter (PC) in 8085 Microprocessor

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 8K+ Views

PC is a 16-bit register. It contains a memory address. PC contains that very memory address from where the next instruction is to be fetched for execution. Suppose the PC contents are 8000H, then it means that the 8085 Desires to fetch the instruction Byte at 8000H. After fetching the Byte at 8000H, the PC is automatically incremented by 1. This way 8085 becomes ready to fetch the next Byte of the instruction (in case instruction fetch is incomplete), or fetch the next opcode (in case instruction fetch is over).So in this example, first of all PC is loaded with ...

Read More

How can I enforce compound uniqueness in MySQL?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 112 Views

You can enforce compound uniqueness in MySQL with the help of UNIQUE keyword. Here is the syntax to add UNIQUE keyword to your table column.The syntax is as followsCREATE TABLE yourTableName (    yourColumnName1 datatype,    yourColumnName2 datatype,    yourColumnName3 datatype,    .    .    N    UNIQUE yourConstarintName(yourColumnName2, yourColumnName3) );To understand the above concept, let us create a table with some columns and add a unique constraint to a table. The query to create a table is as followsmysql> create table UniqueDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(100), ...

Read More

Timing and control unit in 8085 Microprocessor

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 15K+ Views

We use Timing and Controlling unit in 8085 for the generation of timing signals and the signals to control. All the operations and functions both interior and exterior of a microprocessor are controlled by this unit. X2 and CLK output pins: To do or rather perform the operations of timing in the microcomputer system, we have a generator called clock generator in the CU of 8085. Other than the quartz crystal the complete circuit of the oscillator is within the chip. The two pins namely X1 and X2 are taken out from the chip to give the connection to the ...

Read More

How to compare two strings which are numbers in MySQL?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 1K+ Views

To compare two strings which are numbers in MySQL, use the CAST() function.The syntax is as followsselect *from yourTableName where cast(yourColumnName as signed)=yourIntegerValue;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table compareTwoStringDemo -> ( -> UserId varchar(100) -> ); Query OK, 0 rows affected (0.78 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into compareTwoStringDemo values('1083745'); Query OK, 1 row affected (0.12 sec) mysql> insert into compareTwoStringDemo values('9867585'); Query OK, 1 ...

Read More

How to reduce MongoDB storage space after deleting large amount of data?

Chandu yadav
Chandu yadav
Updated on 30-Jul-2019 514 Views

To reduce MongoDB storage space after deleting a large amount of data, you need to use repairDatabase(). Let’s say we are using the database “test”. Following is the query to get to the current database> db;This will produce the following outputTestAfter deleting large amount of data, this is how you can reduce the storage space of MongoDB> db.repairDatabase()This will produce the following output{ "ok" : 1 }Here is the screenshot after we implement the above query. This will reduce the storage space:

Read More
Showing 661–670 of 810 articles
« Prev 1 65 66 67 68 69 81 Next »
Advertisements