Abhinaya has Published 75 Articles

How GET_FORMAT() function can combine with DATE_FORMAT() and STR_TO_DATE() function?

Abhinaya

Abhinaya

Updated on 20-Jun-2020 07:03:53

It is very useful to combine GET_FORMAT() function with DATE_FORMAT() and STR_TO_DATE() function.Combining with DATE_FORMAT()When it is combined with DATE_FORMAT() then it would arrange a particular date or time or datetime in a format obtained from GET_FORMAT() function.mysql> Select DATE_FORMAT('2017-10-22', GET_FORMAT(date, 'USA'))AS 'DATE IN USA FORMAT'; +-------------------+ | DATE IN ... Read More

How can we calculate the difference between two time values in MySQL?

Abhinaya

Abhinaya

Updated on 20-Jun-2020 06:28:18

With the help of TIMEDIFF() MySQL function the difference between two-time values can be calculated.Examplemysql> Select TIMEDIFF('04:05:45','03:05:45') AS ‘Difference in Time’; +---------------------------------+ | Difference in Time              | +---------------------------------+ | 01:00:00                        | +---------------------------------+ 1 row in set (0.00 sec)

How MySQL performs date arithmetic with addition and subtraction operators?

Abhinaya

Abhinaya

Updated on 19-Jun-2020 13:45:14

MySQL can perform date arithmetic with addition and subtraction operators by adding together INTERVAL keyword with a unit of time, date or datetime.Example1Adding 2 days to a particular date.mysql> Select '2017-05-20' + INTERVAL 2 day; +-------------------------------+ | '2017-05-20' + INTERVAL 2 day | +-------------------------------+ | 2017-05-22         ... Read More

What are default function parameters in JavaScript?

Abhinaya

Abhinaya

Updated on 19-Jun-2020 11:27:20

The default parameters came to handle function parameters with ease. You can easily set default parameters to allow initializing formal parameters with default values. This is possible only if no value or undefined is passed.ExampleLet’s see an example −                    // ... Read More

What is onerror() Method in JavaScript?

Abhinaya

Abhinaya

Updated on 19-Jun-2020 08:54:39

The onerror event handler was the first feature to facilitate error handling in JavaScript. The error event is fired on the window object whenever an exception occurs on the page.ExampleYou can try to run the following code to implement onerror() method in JavaScript −           ... Read More

What is ternary operator (? X : Y) in C++?

Abhinaya

Abhinaya

Updated on 18-Jun-2020 13:45:52

The conditional operator (? :) is a ternary operator (it takes three operands). The conditional operator works as follows −The first operand is implicitly converted to bool. It is evaluated and all side effects are completed before continuing.If the first operand evaluates to true (1), the second operand is evaluated.If ... Read More

How to remove first array element in JavaScript and return it?

Abhinaya

Abhinaya

Updated on 18-Jun-2020 09:17:42

To remove first array element, use the JavaScript shift() method. JavaScript array shift() method removes the first element from an array and returns that element.ExampleYou can try to run the following code to remove first array element and return it −Live Demo           JavaScript Array shift Method ... Read More

How to Plot Complex Numbers in Python?

Abhinaya

Abhinaya

Updated on 18-Jun-2020 06:38:34

You can plot complex numbers on a polar plot. If you have an array of complex numbers, you can plot it using:import matplotlib.pyplot as plt import numpy as np cnums = np.arange(5) + 1j * np.arange(6, 11) X = [x.real for x in cnums] Y = [x.imag for x ... Read More

Why multiple inheritance is not supported in Java

Abhinaya

Abhinaya

Updated on 17-Jun-2020 07:23:05

In Java, a class cannot extend more than one class. Therefore following is illegal −Examplepublic class extends Animal, Mammal{}However, a class can implement one or more interfaces, which has helped Java get rid of the impossibility of multiple inheritances.The reason behind this is to prevent ambiguity.Consider a case where class ... Read More

What is the difference between final, finally and finalize() in Java?

Abhinaya

Abhinaya

Updated on 16-Jun-2020 11:15:20

The final keyword can be used with class method and variable. A final class cannot be instantiated, a final method cannot be overridden and a final variable cannot be reassigned.The finally keyword is used to create a block of code that follows a try block. A finally block of code always executes, ... Read More

Advertisements