Ayyan has Published 53 Articles

How to run a java program

Ayyan

Ayyan

Updated on 19-Feb-2024 04:11:09

258K+ Views

Compiling and running a java program is very easy after JDK installation. Following are the steps −Open a command prompt window and go to the directory where you saved the java program (MyFirstJavaProgram.java). Assume it's C:\.Type 'javac MyFirstJavaProgram.java' and press enter to compile your code. If there are no errors ... Read More

Match any string containing at most one p.

Ayyan

Ayyan

Updated on 23-Jun-2020 08:26:03

109 Views

To match any string containing zero or one p’s with JavaScript RegExp, use the p? Quantifier.ExampleYou can try to run the following code to match any string containing zero or one p. Here p is considered a number of occurrences −           JavaScript Regular Expression   ... Read More

With JavaScript RegExp search a carriage return character.

Ayyan

Ayyan

Updated on 23-Jun-2020 07:45:25

483 Views

To find carriage return character with JavaScript Regular Expression, use the following −\rExampleYou can try to run the following code to find a carriage return character. It returns the position where the carriage return (\r) character is found −           JavaScript Regular Expression     ... Read More

How can we modify a MySQL view with CREATE OR REPLACE VIEW statement?

Ayyan

Ayyan

Updated on 22-Jun-2020 13:40:10

321 Views

As we know that we can modify a view by using ALTER VIEW statement but other than that we can also use CREATE OR REPLACE VIEW to modify an existing view. The concept is simple as MySQL simply modifies the view if it already exists otherwise a new view would ... Read More

How can we create multiple MySQL triggers for the same trigger event and action time?

Ayyan

Ayyan

Updated on 22-Jun-2020 12:11:45

457 Views

MySQL 5.7.2+ allows us to create multiple triggers for the same event and action time in a table. Both the triggers will activate sequentially when the event occurs. It can be understood with the help of an example −ExampleIn this example,  we are creating multiple triggers for the same event ... Read More

What kind of output is returned by MySQL scalar subquery? What are the restrictions on using it with MySQL query?

Ayyan

Ayyan

Updated on 22-Jun-2020 08:11:54

242 Views

MySQL scalar subquery returns exactly one column value from one row and we can use it where a single column is permissible. Followings are the cases when scalar subqueries return value other than one row −Case1 − When it returns 0 rowsIn case if the subquery returns 0 rows then ... Read More

How can we update MySQL table after padding a string with the values of the column?

Ayyan

Ayyan

Updated on 22-Jun-2020 07:43:46

723 Views

We can update MySQL table after padding a string with the values of a column by using LPAD() or RPAD() function along with UPDATE clause. Following the example from ‘examination_btech’ table will make it clearer −ExampleSuppose if we want to append the values, in last, of column course with the ... Read More

In function INSERT(str, Pos, len, newstr), what would be the result if ‘len’ is not within the length of the rest of string?

Ayyan

Ayyan

Updated on 22-Jun-2020 06:05:15

44 Views

In case if ‘len’ is not within the length of the rest of the string then MySQL INSERT() function will continue to remove the characters until the end of the original string.Examplemysql> Select INSERT('myteststring',3,15,'name'); +------------------------------------+ | INSERT('myteststring',3,15,'name') | +------------------------------------+ | myname                             | +------------------------------------+ 1 row in set (0.00 sec)

What happens if the argument ‘count’ in MySQL SUBSTRING_INDEX() function has the value greater than the total number of occurrences of delimiter?

Ayyan

Ayyan

Updated on 22-Jun-2020 05:54:07

119 Views

MySQL SUBSTRING_INDEX() function will return the same string as output if the argument ‘count’ has the value greater than the total number of occurrences of delimiter. It can be demonstrated with the following example −mysql> Select SUBSTRING_INDEX('My Name is Ram', 'a', 3); +-----------------------------------------+ | SUBSTRING_INDEX('My Name is Ram', 'a', 3) ... Read More

How can we calculate the Date in MySQL using functions?

Ayyan

Ayyan

Updated on 20-Jun-2020 13:55:26

89 Views

In MySQL, we can use the following functions to calculate the Date −CURDATE() Function − Basically it returns the current date of the computer.YEAR() Function − It returns the year of the specified date.MONTH() function − It returns the month of the specified date.DAY() Function − It returns the day ... Read More

Advertisements