Arushi has Published 141 Articles

How to parse JSON in Java?

Arushi

Arushi

Updated on 22-Jun-2020 11:30:03

4K+ Views

This articles covers how to encode and decode JSON objects using Java programming language. Let's start with preparing the environment to start our programming with Java for JSON.EnvironmentBefore you start with encoding and decoding JSON using Java, you need to install any of the JSON modules available. For this tutorial ... Read More

How can we use a MySQL subquery with FROM clause?

Arushi

Arushi

Updated on 22-Jun-2020 08:38:19

275 Views

Subqueries can work well in a SELECT statement FROM clause. Following is the syntax for the same −SELECT … FROM(subquery) [AS] name …To make it understand we are using the following data from table ‘cars’ −mysql> Select * from Cars; +------+--------------+---------+ | ID   | Name         ... Read More

What is the default type of a bit value assigned to user variables?

Arushi

Arushi

Updated on 22-Jun-2020 05:39:42

171 Views

By default, the bit values assigned to the user variables are binary strings. It can be illustrated by assigning the bit value to a user variable and then by retrieving them as follows −mysql> SET @abc = 0b1000011; Query OK, 0 rows affected (0.00 sec) mysql> Select @abc; +------+ ... Read More

Find max and min values in an array of primitives using Java

Arushi

Arushi

Updated on 21-Jun-2020 14:36:33

529 Views

This example shows how to search the minimum and maximum element in an array by using Collection.max() and Collection.min() methods of Collection class.Exampleimport java.util.Arrays; import java.util.Collections; public class Main {    public static void main(String[] args) {       Integer[] numbers = { 8, 2, 7, 1, ... Read More

Difference between HashMap and ConcurrentHashMap in Java

Arushi

Arushi

Updated on 21-Jun-2020 12:18:12

6K+ Views

Following are the notable differences between HashMap and ConcurrentHashMap classes in Java. HashMapConcurrentHashMapSynchronizedHashMap is not synchronized.ConcurrentHashMap is synchronized.Thread SafeHashMap is not thread safe.ConcurrentHashMap is thread safe.Iterator typeHashMap iterator is fail-fast and ArrayList throws ConcurrentModificationException if concurrent modification happens during iteration.ConcurrentHashMap is fail-safe and it will never throw ConcurrentModificationException during iteration.Null valuesHashMap ... Read More

How can we get randomly different set of rows or values each time from MySQL table?

Arushi

Arushi

Updated on 20-Jun-2020 13:14:05

123 Views

When we use RAND() function along with both ORDER BY and LIMIT clause in a query, MySQL returns the different set of rows or values each time. To understand it considers a table ‘Employee’ having the following records −mysql> Select * from Employee; +----+--------+--------+ | ID | Name   | ... Read More

How can it be possible to invert a string in MySQL?

Arushi

Arushi

Updated on 20-Jun-2020 10:52:21

211 Views

MySQL REVERSE() function make it possible to invert a string. Its syntax is as follows −SyntaxREVERSE(STR)Here, STR is a string which we want to invert.Examplemysql> Select REVERSE('MySQL'); +------------------+ | REVERSE('MySQL') | +------------------+ | LQSyM            | +------------------+ 1 row in set (0.05 sec)

How can we use FIND_IN_SET() function with MySQL WHERE clause?

Arushi

Arushi

Updated on 20-Jun-2020 08:45:16

1K+ Views

When we use FIND_IN_SET() function in WHERE clause then it searches the search string within the given string as specified in the argument and retrieves all the columns from concerned rows. Following is an example to demonstrate it −ExampleIn this example, we are getting the columns from ‘Student’ table where ... Read More

What is the difference between MySQL LENGTH() and CHAR_LENGTH() function?

Arushi

Arushi

Updated on 20-Jun-2020 08:07:49

3K+ Views

Both the functions are string functions and return the number of characters present in the string. But they differ in the concept that CHAR_LENGTH() function measures the string length in ‘characters’ whereas LENGTH() function measures the string length in ‘bytes’. In other words, we can say that CHAR_LENGTH() function is ... Read More

While fetching the data as output, how can I use multiple conditions on same column?

Arushi

Arushi

Updated on 20-Jun-2020 06:23:33

155 Views

Followings are the ways in which we can write a query that returns only records that matches multiple conditions on the same columnBy using ‘OR’ logical operatorAs we know that MySQL ‘OR’ operator compares two expressions and returns TRUE if either of the expression is TRUE. Following example demonstrate that ... Read More

Advertisements