George John has Published 1081 Articles

How to select unique value in MySQL?

George John

George John

Updated on 30-Jul-2019 22:30:25

2K+ Views

You can select unique value with the help of DISTINCT keyword.The syntax is as followsselect distinct yourColumnName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table selectUniqueValue -> ( -> Id ... Read More

Can we remove _id from MongoDB query result?

George John

George John

Updated on 30-Jul-2019 22:30:25

5K+ Views

To remove _id from MongoDB result, you need to set 0 for _id field. Following is the syntaxdb.yourCollectionName.find({}, {_id:0});To understand it, let us create a collection with documents. Following is the query> db.removeIdDemo.insertOne({"UserName":"John", "UserAge":23}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c9bb4042d66697741252440") } > db.removeIdDemo.insertOne({"UserName":"Mike", "UserAge":27}); {    "acknowledged" ... Read More

Display sum in last row of table using MySQL?

George John

George John

Updated on 30-Jul-2019 22:30:25

1K+ Views

To display sum in last row of a table, you can use UNION. To understand how, let us create a tablemysql> create table showSumInLastRowDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(20),    -> StudentMarks int    -> ); Query OK, 0 ... Read More

exit() vs _Exit() function in C and C++

George John

George John

Updated on 30-Jul-2019 22:30:25

459 Views

In this section we will see what are the differences between exit() and _Exit() in C and C++. In C the exit() terminates the calling process without executing the remaining code which is present after exit() function.In C++11, one new function is present called _Exit(). So what is the feature ... Read More

Internal address latch in 8085 Microprocessor

George John

George John

Updated on 30-Jul-2019 22:30:25

484 Views

The select unit of the register in the 8085 selects any one of the register pairs (BC, DE, HL, SP, PC, or WZ) for sending them to it to the latch unit specified for addressing. For example, the contents of the PC be C200H. If the selection unit be the ... Read More

Count multiple occurrences of separate texts in MySQL?

George John

George John

Updated on 30-Jul-2019 22:30:25

355 Views

You can use aggregate function count along with if() for this. To understand the concept, let us create a table. The query to create a table is as followsmysql> create table CountOccurrencesDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> TechnicalSubject varchar(100)    -> ... Read More

LongStream toArray() method in Java

George John

George John

Updated on 30-Jul-2019 22:30:25

162 Views

The toArray() method of the LongStream class returns an array containing the elements of this stream.The syntax is as follows.long[] toArray()To use the LongStream class in Java, import the following package.import java.util.stream.LongStream;Create LongStream and add some elements.LongStream longStream = LongStream.of(25000L, 28999L, 6767788L);Create a Long array and use the toArray() method ... Read More

8085 program to find the factorial of a number

George John

George John

Updated on 30-Jul-2019 22:30:25

11K+ Views

In this program we will see how to find the factorial of a number.Problem StatementWrite 8085 Assembly language program to find the factorial of an 8-bit number.DiscussionIn 8085, there is no direct instruction to perform multiplication. We need to perform repetitive addition to get the result of the multiplication. In ... Read More

How to fasten MySQL inserts?

George John

George John

Updated on 30-Jul-2019 22:30:25

154 Views

You can speed the MySQL insert when you are inserting multiple records at the same time with the help of the following syntaxSTART TRANSACTION insert into insertDemo(yourColumnName1, yourColumnName2, ...N) values(yourValue1, yourValue2, ....N), (yourValue1, yourValue2, ....N), .......N commitLet us first create a demo tablemysql> create table insertDemo    -> (   ... Read More

C++ Program to Perform Searching Using Self-Organizing Lists

George John

George John

Updated on 30-Jul-2019 22:30:25

403 Views

Self-Organizing list basically updates the list of given range of items on the basis of last searched item. In this method, the sequential searching approach is used. This algorithm shifts the more important data to the beginning of the list. The time complexity of this search technique is O(n).AlgorithmBegin   ... Read More

Advertisements