Samual Sam has Published 2310 Articles

Create Quartet Tuple from another collection in Java

Samual Sam

Samual Sam

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

106 Views

Use the fromCollection() method to create Quartet Tuple from another collection i.e. we will see an example of List here.Let us first see what we need to work with JavaTuples. To work with Quartet class in JavaTuples, you need to import the following package −import org.javatuples.Quartet;Note − Steps to download ... Read More

LocalDate plusWeeks() method in Java

Samual Sam

Samual Sam

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

358 Views

An immutable copy of the LocalDate where the weeks are added to it can be obtained using the plusWeeks() method in the LocalDate class in Java. This method requires a single parameter i.e. the number of weeks to be added and it returns the instant with the added weeks.A program ... Read More

How to convert Integer array list to integer array in Java?

Samual Sam

Samual Sam

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

2K+ Views

To convert integer array list to integer array is not a tedious task. First, create an integer array list and add some elements to it −ArrayList < Integer > arrList = new ArrayList < Integer > (); arrList.add(100); arrList.add(200); arrList.add(300); arrList.add(400); arrList.add(500);Now, assign each value of the integer array list ... Read More

How to convert all the records in a MySQL table from uppercase to lowercase?

Samual Sam

Samual Sam

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

809 Views

Convert all the records in a MySQL table from uppercase to lowercase using UPDATE command along with LOWER() method.Let us first create a table −mysql> create table DemoTable    (    Id varchar(100),    StudentFirstName varchar(20),    StudentLastName varchar(20),    StudentCountryName varchar(10)    ); Query OK, 0 rows affected (0.61 ... Read More

MongoDB query to remove item from array?

Samual Sam

Samual Sam

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

252 Views

To remove item from array, you can use $pull operator. Let us create a collection with documents −> db.removeItemFromArray.insertOne(    { "_id":101, "StudentName":"Larry", "StudentSubjects":["C", "MongoDB", "Java", "MySQL"] } ); { "acknowledged" : true, "insertedId" : 101 }Display all documents from a collection with the help of find() method. The query ... Read More

Create Unit Tuple from List in Java

Samual Sam

Samual Sam

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

158 Views

To create Unit Tuple from another collection, use the fromCollection() method. Here, we will create a Unit Tuple from a List collection, therefore the same method is used.Let us first see what we need to work with JavaTuples. To work with JavaTuples. To work with the Unit class in JavaTuples, ... Read More

How to count all characters in all rows of a field in MySQL?

Samual Sam

Samual Sam

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

1K+ Views

The syntax is as follows to count all characters in all rows of a field −select sum(char_length(yourColumnName)) AS anyAliasName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table CountAllCharactersDemo    -> (    -> UserId int NOT ... Read More

LocalDate plusYears() method in Java

Samual Sam

Samual Sam

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

1K+ Views

An immutable copy of the LocalDate where the years are added to it can be obtained using the plusYears() method in the LocalDate class in Java. This method requires a single parameter i.e. the number of years to be added and it returns the instant with the added years.A program ... Read More

How to get field name types from a MySQL database?

Samual Sam

Samual Sam

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

344 Views

You can use INFORMATION_SCHEMA.COLUMNS for this. Following is the syntax −SELECT COLUMN_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='yourTableName';Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    ClientName varchar(60),    ClientAge int,    ClientSalary DECIMAL(10, 4),    isRegularClient bool   ... Read More

How to select part of a Timestamp in a MySQL Query?

Samual Sam

Samual Sam

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

182 Views

To select part of a timestamp in a query, you need to use YEAR() function. The syntax is as follows in MySQL.select YEAR(yourTimestampColumnName) as anyAliasName from yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table SelectPartOfTimestampDemo ... Read More

Advertisements