George John has Published 1167 Articles

How to move data between two tables with columns in different MySQL databases?

George John

George John

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

502 Views

For this, you need to use an INSERT SELECT statement. The syntax is as followsINSERT INTO yourDatabaseName1.yourTableName1(yourColumnName1, yourColumnName2, ....N) SELECT yourColumnName1, yourColumnName2, ....N FROM yourdatabaseName2.yourTableName2;Here, I am using the following two databasessampletestLet us create the first table in the “test” databasemysql> use test; Database changed mysql> create table send   ... Read More

The subList() method of AbstractList class in Java

George John

George John

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

83 Views

The subList() method returns a part of this list between the specified fromIndex, inclusive, and toIndex, exclusive. Get a sublist using the method by setting the range as the two parameters.The syntax is as follows.public List subList(int fromIndex, int toIndex)Here, the parameter fromIndex is the low endpoint (inclusive) of the ... Read More

log() function in C++

George John

George John

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

561 Views

The C/C++ library function double log(double x) returns the natural logarithm (basee logarithm) of x. Following is the declaration for log() function.double log(double x)The parameter is a floating point value. And this function returns natural logarithm of x.Example Live Demo#include #include using namespace std; int main () {   ... Read More

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

351 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

362 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

C++ Program to Perform the Shaker Sort

George John

George John

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

1K+ Views

Shaker sort is used to sort the given data. Shaker sort, unlike Bubble sort, orders the array in both directions. The worst complexity of this algorithm is O(n^2).AlgorithmBegin    ShakerSort() function has ‘arr’ the array of data and ‘n’ the number of values, in the argument list.    // Implement ... Read More

Count multiple occurrences of separate texts in MySQL?

George John

George John

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

272 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

Advertisements