AmitDiwan has Published 10744 Articles

Fetch maximum value from multiple columns with null and non-null values?

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 05:39:49

465 Views

For this, you can use COALESCE(). For the maximum value, use GREATEST() in MySQL. Let us first create a table −mysql> create table DemoTable    -> (    -> Value1 int,    -> Value2 int,    -> Value3 int    -> ); Query OK, 0 rows affected (0.61 sec)Insert some ... Read More

Format MySQL records (price values) after multiplying them

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 05:36:53

195 Views

To format records, use FORMAT(). Let us first create a table −mysql> create table DemoTable    -> (    -> Price decimal(10, 4),    -> Rate decimal(10, 4)    -> ); Query OK, 0 rows affected (0.96 sec)Insert some records in the table using insert command −mysql> insert into DemoTable ... Read More

MySQL LIKE command doesn't work with strings containing dots to display records beginning with a specific number

AmitDiwan

AmitDiwan

Updated on 17-Dec-2019 05:34:46

506 Views

To work with strings containing dots, and display records beginning with a specific number, you need to use REGEXP. Let us first create a table −mysql> create table DemoTable    -> (    -> GameReleaseVersion varchar(20)    -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the ... Read More

Setting the capacity to the actual number of elements in a SortedList object in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 12:37:04

131 Views

To set the capacity to the actual number of elements in a SortedList object, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args) {       SortedList sortedList = new SortedList();       sortedList.Add("A", "1");     ... Read More

Total number of elements in a specified dimension of an Array in C#

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 10:28:34

113 Views

To get the total number of elements in a specified dimension of an array, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       string[] products = new string[] { "Andy", "Mark", "Gary", "Andre"};       Console.WriteLine("One or ... Read More

Set the capacity to the actual number of elements in the ArrayList in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 10:18:04

120 Views

To set the capacity to the actual number of elements in the ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args) {       ArrayList list1 = new ArrayList();       list1.Add("A");       list1.Add("B"); ... Read More

Search for an element matching the conditions and return the zero-based index of the last occurrence within the entire List in C#

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 10:13:38

203 Views

To search for an element matching the conditions and return the zero-based index of the last occurrence within the entire List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    private static bool demo(int i) {       return ((i % 10) == ... Read More

Searching the index of specified object in Collection in C#

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 10:10:07

156 Views

To search the index of specified object in Collection, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo {    public static void Main() {       StringCollection strCol = new StringCollection();       strCol.Add("Accessories");       strCol.Add("Books");       strCol.Add("Electronics");   ... Read More

Number of elements contained in the BitArray in C#?

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 10:04:35

97 Views

To get the number of elements contained in the BitArray, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       BitArray arr1 = new BitArray(5);       BitArray arr2 = new BitArray(5);       arr1[0] ... Read More

How to check whether a thread is alive or not in C#

AmitDiwan

AmitDiwan

Updated on 16-Dec-2019 10:00:54

586 Views

To check whether a thread is alive or not, the code is as follows −Example Live Demousing System; using System.Threading; public class Demo {    public static void Main() {       Thread thread = new Thread(new ThreadStart(demo1));       thread = Thread.CurrentThread;       Console.WriteLine("Is the thread ... Read More

Advertisements