George John has Published 1081 Articles

DoubleStream.Builder build() method in Java

George John

George John

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

119 Views

The build() method of the DoubleStream.Builder class builds the stream. It transitions this builder to the built state.The syntax is as followsDoubleStream build()To use the DoubleStream.Builder class in Java, import the following packageimport java.util.stream.DoubleStream;The following is an example to implement DoubleStream.Builder build() method in Java:Example Live Demoimport java.util.stream.DoubleStream; public class Demo ... Read More

Resolve Unknown database in JDBC error with Java-MySQL?

George John

George John

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

9K+ Views

This type of error occurs if you select any database that does not exist in MySQL. Let us first display the error of unknown database in JDBC.The Java code is as follows. Here, we have set the database as ‘onlinebookstore’, which does not exist:import java.sql.Connection; import java.sql.DriverManager; public class UnknownDatabaseDemo ... Read More

Difference between count(*) and count(columnName) in MySQL?

George John

George John

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

3K+ Views

The count(*) returns all rows whether column contains null value or not while count(columnName) returns the number of rows except null rows.Let us first create a table.Following is the querymysql> create table ifNotNullDemo    -> (    -> Name varchar(20)    -> ); Query OK, 0 rows affected (0.54 sec)Following ... Read More

Can we order a MySQL result with mathematical operations?

George John

George John

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

269 Views

Yes, we can order with mathematical operations using ORDER BY clause. Let us first create a table:mysql> create table orderByMathCalculation    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> Quantity int,    -> Price int    -> ); Query OK, 0 rows affected (0.57 sec)Following ... Read More

How to add column using alter in MySQL?

George John

George John

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

211 Views

Following is the syntax to add column using alter in MySQL:alter table yourTableName add column yourColumnName yourDataType default yourValue;Let us first create a table:mysql> create table alterTableDemo    -> (    -> Id int,    -> Name varchar(10)    -> ); Query OK, 0 rows affected (0.69 sec)Let us check ... Read More

How to suppress MySQL stored procedure output?

George John

George John

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

1K+ Views

To suppress MySQL stored procedure output, you can use variable. Let us first create a table.mysql> create table person_information    -> (    -> Id int,    -> Name varchar(20)    -> ); Query OK, 0 rows affected (0.50 sec)Following is the query to insert some records in the table ... Read More

Write a MySQL query equivalent to “SHOW TABLES” in sorted order?

George John

George John

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

140 Views

Use INFORMATION_SCHEMA.TABLES to display tables in sorted order. The below syntax will give sorted list of tables in ascending order:select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA= 'yourDatabaseName' order by TABLE_NAME;Following is the query to implement the equivalent to SHOW TABLES:mysql> select TABLE_NAME from INFORMATION_SCHEMA.TABLES    -> where TABLE_SCHEMA= 'sample' order by ... Read More

The codePoints() method in Java IntStream

George John

George John

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

411 Views

The codePoint() method is used to display a stream of code point values from the given sequence.The syntax is as followsIntStream codePoints()To work with Java IntStream class, you need to import the following packageimport java.util.stream.IntStream;Here is our stringString myStr = "Example!";Now, get the code point valuesIntStream intStream = myStr.codePoints();The following ... Read More

MySQL query to get the count of rows in which two or more specified values appear?

George John

George John

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

84 Views

To get the count of rows in which two or more specified values appear, let us first create a sample table:mysql> create table specifiedValuesDemo -> ( -> Value int, -> Value2 int, -> Value3 int ... Read More

How to create double nested array in MongoDB?

George John

George John

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

334 Views

To create a double nested array in MongoDB, let us implement the query to create a collection with documents. Within that, we have created a double nested array that displays Student Details, with the project name and technologies used to develop the same project:> db.doubleNestedArrayDemo.insertOne( ... { ...    "StudentId" ... Read More

Advertisements