Samual Sam has Published 2492 Articles

Add a temporary column in MySQL where the values depend on another column?

Samual Sam

Samual Sam

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

1K+ Views

You can use CASE statement for this and set conditions to get result in the temporary column.Let us first create a table −mysql> create table DemoTable    (    EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    EmployeeName varchar(20),    EmployeeSalary int,    EmployeeExperience int    ); Query OK, 0 ... Read More

Exact count of all rows in MySQL database?

Samual Sam

Samual Sam

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

329 Views

To exactly count all rows, you need to use the aggregate function COUNT(*). The syntax is as follows −select count(*) 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 CountAllRowsDemo    -> (   ... Read More

Duration plusDays() method in Java

Samual Sam

Samual Sam

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

94 Views

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

Using MySQL SELECT for simple BOOLEAN evaluation?

Samual Sam

Samual Sam

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

219 Views

You can use CASE statement for this. Let us see an example −mysql> create table BooleanEvaluationDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> FirstValue int,    -> SecondValue int    -> ); Query OK, 0 rows affected (0.71 sec)Insert some records in the ... Read More

Create Quartet Tuple from another collection in Java

Samual Sam

Samual Sam

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

63 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

207 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

661 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

202 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

83 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

Advertisements