Match Values with Backslashes from MySQL Column

V Jyothi
Updated on 22-Jun-2020 12:27:40

861 Views

With the help of an RLIKE operator, we can perform such kind of matching. The only concept is about to use a number of backslashes in MySQL query. The example below will make it clearer −We have the following table having values such as ‘a\b’ and ‘a\b’.mysql> select * from backslashes; +------+-------+ | Id   | Value | +------+-------+ |    1 | 200   | |    2 | 300   | |    4 | a\b  | |    3 | a\b   | +------+-------+ 4 rows in set (0.10 sec)Now suppose if we want to match the ... Read More

Loop Through All Elements of an Array in C#

Ankith Reddy
Updated on 22-Jun-2020 12:26:59

287 Views

Firstly, set an array and initialize it −int[] arr = new int[] {34, 56, 12};To loop through all the elements of an array −for (int i = 0; i < arr.Length; i++) {    Console.WriteLine(arr[i]); }Let us see the complete code −Exampleusing System; public class Program {    public static void Main() {       int[] arr = new int[] {34, 56, 12};       // Length       Console.WriteLine("Length:" + arr.Length);       for (int i = 0; i< arr.Length; i++) {          Console.WriteLine(arr[i]);       }    } }

Fetch Alternate Even Numbered Records from MySQL Table

Sravani S
Updated on 22-Jun-2020 12:26:48

370 Views

To understand this concept we are using the data from table ‘Information’ as follows −mysql> Select * from Information; +----+---------+ | id | Name    | +----+---------+ |  1 | Gaurav  | |  2 | Ram     | |  3 | Rahul   | |  4 | Aarav   | |  5 | Aryan   | |  6 | Krishan | +----+---------+ 6 rows in set (0.00 sec)Now, the query below will fetch the alternate even-numbered records from the above table ‘Information’ −mysql> Select id,Name from information group by id having mod(id,2) = 0; +----+---------+ | id | Name    | +----+---------+ |  2 | Ram     | |  4 | Aarav   | |  6 | Krishan | +----+---------+ 3 rows in set (0.00 sec)

Traversal in Singly Linked List Using C Hash

Arjun Thakur
Updated on 22-Jun-2020 12:26:27

582 Views

Set a linkelist collection −var list = new LinkedList();Now, add elements −list.AddLast("One"); list.AddLast("Two"); list.AddLast("Four");Now, let us add new elements in the already created LinkedList −LinkedListNode node = list.Find("Four"); list.AddBefore(node, "Three"); list.AddAfter(node, "Five");Let us now see how to traverse through the nodes in a Singly Linked List −Exampleusing System; using System.Collections.Generic; public class Demo {    public static void Main(string[] args) {       var list = new LinkedList < string > ();       list.AddLast("One");       list.AddLast("Two");       list.AddLast("Four");       Console.WriteLine("Travering...");       foreach(var res in list) {   ... Read More

Delete Existing MySQL Event Permanently

Anjana
Updated on 22-Jun-2020 12:26:04

354 Views

We need to use the DROP statement to delete an existing MySQL event permanently. To illustrate it we are deleting the event named testing_event as follows −Examplemysql> DROP EVENT testing_event; Query OK, 0 rows affected (0.00 sec)

Enter Characters as Hexadecimal (HEX) Number in MySQL Statement

mkotla
Updated on 22-Jun-2020 12:25:02

1K+ Views

Following are the two approaches with the help of which we can enter characters 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 character string.Examplemysql> Select X'5152545678'; +---------------+ | X'5152545678' | +---------------+ | QRTVx         | +---------------+ 1 row in set (0.00 sec)By prefix 0xIn this approach, we need to write hexadecimal numbers without any quotes with a prefix of 0x. Then HEX number string will be automatically converted into a character string.Examplemysql> ... Read More

Escape Special Characters in MySQL Statement

Nishtha Thakur
Updated on 22-Jun-2020 12:24:08

1K+ Views

Sometimes we need to include special characters in a character string and at that time they must be escaped or protected. We need to pursue some basic rules for escaping special characters which are given below −The escape character (\) can be escaped as (\)Examplemysql> Select 'A\B'; +-----+ | A\B | +-----+ | A\B | +-----+ 1 row in set (0.00 sec)

Obtain Status of the Current Thread in C#

karthikeya Boyini
Updated on 22-Jun-2020 12:23:59

226 Views

To get the status of current thread, use the IsAlive() method −Firstly, create a new thread −Thread t = Thread.CurrentThread; t.Name = "Our Thread";Now, to get the status of the current thread −t.IsAliveThe following is the complete code −Example Live Demousing System; using System.Threading; namespace Demo {    class MyClass {       static void Main(string[] args) {          Thread t = Thread.CurrentThread;          t.Name = "Our Thread";          Console.WriteLine("Status = {0}", t.IsAlive);          Console.ReadKey();       }    } }OutputStatus = True

Initialize a Rectangular Array in C#

Chandu yadav
Updated on 22-Jun-2020 12:23:31

418 Views

An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type stored at contiguous memory locations.Multi-dimensional arrays are also called rectangular array. Multidimensional arrays are initialized by specifying bracketed values for each row.The following array is with 2 rows and each row has 2 columns.int [, ] a = new int [2, 2] { {20, 50} , /* initializers for row indexed by 0 */ {15, 45} , /* initializers for row indexed by 1 */ };Let us see an example ... Read More

Enter Numeric Values as Hexadecimal (HEX) in MySQL Statement

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

229 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 on the expression context.Examplemysql> Select X'5152545678'+ 10; +-------------------+ | X'5152545678'+ 10 | +-------------------+ | 349273609858      | +-------------------+ 1 row in set (0.00 sec)By prefix 0xIn this approach, we need to write hexadecimal numbers without any quotes with a prefix of 0x. Then HEX number string will be automatically ... Read More

Advertisements