Fendadis John has Published 72 Articles

How MySQL SUM() function evaluates if it is used with SELECT statement that returns no matching rows?

Fendadis John

Fendadis John

Updated on 22-Jun-2020 05:09:31

205 Views

When MySQL SUM() function used with SELECT statement that returns no matching rows then there is nothing to evaluate and it returns NULL as output. Sometimes, we thought it must return 0 as output but 0 is a number itself and for no matching rows it not significant to return ... Read More

Generating OTP in Java

Fendadis John

Fendadis John

Updated on 21-Jun-2020 15:00:56

5K+ Views

Generate OTP is now a requirement on most of the website now-a-days. In case of additional authentication, system generates a OTP password adhering to OTP policy of the company. Following example generates a unique OTP adhering to following conditions −It should contain at least one number.Length should be 4 characters.Exampleimport ... Read More

Flexible nature of java.lang.object

Fendadis John

Fendadis John

Updated on 21-Jun-2020 14:35:44

182 Views

The java.lang.Object class is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.Class DeclarationFollowing is the declaration for java.lang.Object class −public class ObjectClass constructorsSr.No.Constructor & Description1Object()This is the Single Constructor.Class methodsSr.No.Method & Description1protected Object clone()This method ... Read More

Floating point operators and associativity in Java

Fendadis John

Fendadis John

Updated on 21-Jun-2020 14:24:45

558 Views

Following programs shows the float arithmetic can cause dubious result if integer values are used using float variables.Examplepublic class Tester {    public static void main(String[] args) {       float a = 500000000;       float b = -500000000;       float c = 1; ... Read More

Different ways for Integer to String conversion in Java

Fendadis John

Fendadis John

Updated on 21-Jun-2020 12:40:05

371 Views

Following are the different ways to convert an Integer to String in Java.Using Integer.toString(int) − Convert an int to String using static toString() method of Integer class.String b = Integer.toString(125);Using String.valueOf(int) − Convert an int to String using static valueOf() method of String class.String b = String.valueOf(125);Using new Integer(int).toString() − ... Read More

Deque interface in Java

Fendadis John

Fendadis John

Updated on 21-Jun-2020 12:26:34

455 Views

java.util.Deque interface is a subtype of java.util.Queue interface which supports insertion and removal of elements at both ends.Interface Declarationpublic interface Deque extends QueueArrayDeque ClassThe java.util.ArrayDeque class provides resizable-array and implements the Deque interface. Following are the important points about Array Deques −Array deques have no capacity restrictions so they grow ... Read More

How to use REPLACE() function with column’s data of MySQL table?

Fendadis John

Fendadis John

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

205 Views

For using it with column’s data we need to provide column name as the argument of REPLACE() function. It can be demonstrated by using ‘Student’ table data as follows −Examplemysql> Select Id, Name, Subject, REPLACE(Subject, 's', ' Science') from Student WHERE Subject = 'Computers'; +------+--------+-----------+-----------------------------------+ | Id   | Name ... Read More

How to add two or more strings in MySQL?

Fendadis John

Fendadis John

Updated on 20-Jun-2020 08:18:58

1K+ Views

A string function called CONCAT() is used to concatenate two or more strings as a single string in MySQL.SyntaxCONCAT(String1, String2, …, StringN)Here, the arguments of CONCAT functions are the strings which need to be concatenated as a single string.Examplemysql> Select CONCAT('Ram', 'is', 'a', 'good', 'boy') AS Remarks; +---------------+ | ... Read More

How can we use WHERE clause with MySQL INSERT INTO command?

Fendadis John

Fendadis John

Updated on 20-Jun-2020 06:17:22

7K+ Views

We can use conditional insert i.e. WHERE clause with INSERT INTO command in the case of new row insertion. It can be done with following ways −With the help of dummy tableIn this case, we insert the value from dummy table along with some conditions. The syntax can be as ... Read More

What is the difference between MySQL TRUNCATE and DELETE command?

Fendadis John

Fendadis John

Updated on 20-Jun-2020 06:02:15

406 Views

As we know that TRUNCATE will remove all the rows without removing table’s structure from the database. Same work can be done with the help of DELETE command on removing all the rows from the table. But there is a significant difference of re-initialization of PRIMARY KEY AUTO_INCREMENT between both ... Read More

Advertisements