Radhakrishna has Published 93 Articles

Merge two sorted arrays in C#

radhakrishna

radhakrishna

Updated on 22-Jun-2020 13:09:18

453 Views

To merge two sorted arrays, firstly set two sorted arrays −int[] array1 = { 1, 2 }; int[] array2 = { 3, 4 };Now, add it to a list and merge −var list = new List(); for (int i = 0; i < array1.Length; i++) {    list.Add(array1[i]);    list.Add(array2[i]); ... Read More

How to set a value to the element at the specified position in the one-dimensional array in C#

radhakrishna

radhakrishna

Updated on 22-Jun-2020 13:05:58

298 Views

Firstly, set the array −int[] p = new int[] {55, 66, 88, 99, 111, 122, 133};Now, let us say you need to set an element at position 1 −p[2] = 77;Let us see the comple code −Example Live Demousing System; namespace Program {    public class Demo {     ... Read More

How can we enter numeric values as Hexadecimal (HEX) number in MySQL statement?

radhakrishna

radhakrishna

Updated on 22-Jun-2020 12:23:10

126 Views

Following are the two approaches with the help of which we can enter numeric values as a Hexadecimal number −By prefix ‘X’In this approach we need to quote hexadecimal numbers within single quotes with a prefix of X. Then HEX number string will be automatically converted into a number based ... Read More

How to get last 4 characters from string inC#?

radhakrishna

radhakrishna

Updated on 22-Jun-2020 12:19:58

2K+ Views

Firstly, set the string −string str = "Football and Tennis";Now, use the substring() method to get the last 4 characters −str.Substring(str.Length - 4);Let us see the complete code −Example Live Demousing System; public class Demo {    public static void Main() {       string str = "Football and Tennis"; ... Read More

What would be the result if we perform any kind of arithmetic calculations in MySQL having one of the arguments as NULL?

radhakrishna

radhakrishna

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

70 Views

MySQL always throws NULL as the result of arithmetic calculations in which one of the arguments is NULL. Consider the following example having NULL as an argument with addition, subtraction, multiplication, and division −mysql> Select 10*NULL; +---------+ | 10*NULL | +---------+ |    NULL | +---------+ 1 row in set ... Read More

How can we use two columns with MySQL WHERE clause?

radhakrishna

radhakrishna

Updated on 22-Jun-2020 10:56:28

394 Views

It is very rarely used to use two columns of the same table in WHERE clause but still we can perform a query with two columns of the same table. Consider the below example −mysql> Select F_name, L_name     -> From Customer     -> where F_name = L_name; ... Read More

How can I get the information about a particular column of a table by MySQL DESCRIBE statement?

radhakrishna

radhakrishna

Updated on 22-Jun-2020 08:18:32

1K+ Views

As we know that DESCRIBE statement will provide the information/structure of the whole table. With the help of DESCRIBE statement along with table name and the column name, we can get the information about that column.SyntaxDESCRIBE table_name col_name;Example1mysql> Describe employee ID; +-------+---------+------+-----+---------+----------------+ | Field | Type    | Null | ... Read More

How can I write a MySQL stored function that calculates the factorial of a given number?

radhakrishna

radhakrishna

Updated on 22-Jun-2020 08:03:24

890 Views

Following is the example of a stored function that can calculate the factorial of a given number −CREATE FUNCTION factorial (n DECIMAL(3, 0)) RETURNS DECIMAL(20, 0) DETERMINISTIC BEGIN DECLARE factorial DECIMAL(20, 0) DEFAULT 1; DECLARE counter DECIMAL(3, 0); SET counter = n; factorial_loop: REPEAT SET factorial = factorial * counter; ... Read More

What are the special security requirements for using stored procedures and functions together with replication?

radhakrishna

radhakrishna

Updated on 22-Jun-2020 07:23:52

161 Views

Actually, a MySQL slave server has the authority to execute any statement read from a master's MySQL server binary log, hence some special security constraints exist for using stored functions with replication. If replication or binary logging in general (for the purpose of point-in-time recovery) is active, then MySQL DBAs ... Read More

Set the height and width of an image using percent with CSS

radhakrishna

radhakrishna

Updated on 22-Jun-2020 05:35:38

697 Views

To set the height and width of an image using %, you can try to run the following code −ExampleLive Demo                    img {             height: 50%;             width: 50%;          }                     Sized image in %          

Advertisements