Chandu yadav has Published 1163 Articles

IntStream findFirst() method in Java

Chandu yadav

Chandu yadav

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

279 Views

The findFirst() method in Java returns an OptionalInt describing the first element of this stream. If the stream is empty, an empty OptionalInt is returned.The syntax is as followsOptionalInt findFirst()Here, OptionalInt is a container object which may or may not contain an int value.To work with the IntStream class in ... Read More

How to add a where clause in a MySQL Insert statement?

Chandu yadav

Chandu yadav

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

141 Views

You need to use UPDATE statement for this.The syntax is as followsupdate yourTableName set yourColumnName1=yourValue1, yourColumnName2=yourValue2, ....N where yourCondition;Let us create a table for our examplemysql> create table addWhereClauseDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(30),    -> StudentPassword varchar(40)   ... Read More

Update one column data to another column in MySQL if the second column is NOT NULL?

Chandu yadav

Chandu yadav

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

3K+ Views

To update one column data to another column, you can use UPDATE command. Let us first create a table −mysql> create table DemoTable (    UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    UserFirstName varchar(20),    ListOfName varchar(20) ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table ... Read More

C Program to print “Hello World!” without using a semicolon

Chandu yadav

Chandu yadav

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

4K+ Views

Let us see how to write a C program in which we can print the text “Hello World” without using any semicolon.We can simply write the text by using the line printf(“Hello World”); in the main() function.But there is a semicolon at the end of the line. To avoid the ... Read More

8086 program to find the min value in a given array

Chandu yadav

Chandu yadav

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

3K+ Views

In this program we will see how to find the minimum number in a given array.Problem StatementWrite 8086 Assembly language program to find the minimum number in a given array, which is starts from memory offset 501. The size of the series is stored at memory offset 500. Store the ... Read More

The addAll() method of AbstractList class in Java

Chandu yadav

Chandu yadav

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

104 Views

The addAll() method of the AbstractList class is used to insert all of the elements in the specified collection into this list at the specified position.The syntax is as followsboolean addAll(int index, Collection

Can we select second largest record from a table without using LIMIT clause in MySQL?

Chandu yadav

Chandu yadav

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

181 Views

Yes, we can select second largest record from a table without using LIMIT clause. Let us first see an example and create a table −mysql> create table DemoTable (    Number int ); Query OK, 0 rows affected (0.66 sec)Insert records in the table using insert command −mysql> insert into ... Read More

How to update date of datetime field with MySQL?

Chandu yadav

Chandu yadav

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

10K+ Views

Update date of datetime field with the help of arithmetic operator minus(-).The syntax is as followsupdate yourTableName set yourDateTimeColumnName=yourDateTimeColumnName - interval yourValue day where date(yourDateTimeColumnName)=’yourDateValue’;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table updateDateDemo    -> (   ... Read More

Finding highest value from sub-arrays in MongoDB documents?

Chandu yadav

Chandu yadav

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

188 Views

To find the highest value from sub-arrays in documents, you can use an aggregate framework. Let us first create a collection with documents> db.findHighestValueDemo.insertOne(    ... {       ... _id: 10001,       ... "StudentDetails": [          ... { "StudentName": "Chris", "StudentMathScore": 56},   ... Read More

C program to write an image in PGM format

Chandu yadav

Chandu yadav

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

1K+ Views

The PGM is the Portable Gray Map. If we want to store a 2d array in C as images in PNG, JPEG, or any other image format, we have to do lots of work to encode the data in some specified format before writing into a file.The Netpbm format gives ... Read More

Advertisements