AmitDiwan has Published 10740 Articles

MySQL query to select multiple rows effectively?

AmitDiwan

AmitDiwan

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

3K+ Views

You need to use index to select multiple rows effectively. Let us first create a table −mysql> create table DemoTable1501    -> (    -> Id int NOT NULL PRIMARY KEY,    -> URL text    -> ); Query OK, 0 rows affected (0.62 sec)Here is the query to create ... Read More

Get the number of key/values pairs contained in OrderedDictionary in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:52:21

120 Views

To get the number of key/values pairs contained in OrderedDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       OrderedDictionary dict = new OrderedDictionary();       dict.Add("A", "Home Appliances");       dict.Add("B", "Electronics"); ... Read More

Only return fields which appear a certain number of times using MySQL DISTINCT?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:49:49

89 Views

To return fields appearing a certain number of times, the syntax is as follows −select distinct yourColumnName, count(yourColumnName) from yourTableName where yourColumnName LIKE 'J%' group by yourColumnName having count(*) > 1 order by yourColumnName;Let us first create a table −mysql> create table DemoTable1500    -> (    -> Name varchar(20) ... Read More

Check if HybridDictionary is Synchronized in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:49:05

135 Views

To check if HybridDictionary is synchronized, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       HybridDictionary dict1 = new HybridDictionary();       dict1.Add("A", "Books");       dict1.Add("B", "Electronics");       dict1.Add("C", "Smart ... Read More

MySQL query to sum up values of rows and sort the result?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:46:53

251 Views

For this, you can use GROUP BY along with ORDER BY clause. Let us first create a table −mysql> create table DemoTable1499    -> (    -> StudentName varchar(20),    -> StudentMarks int    -> ); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert ... Read More

Check if Input, Output and Error is redirected on the Console or not in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:45:53

252 Views

To check if the input is redirected on the Console or not, the code is as follows −Example Live Demousing System; public class Demo{    public static void Main(string[] args){       Console.WriteLine("Input Redirected? = "+Console.IsInputRedirected);    } }OutputThis will produce the following output −Input Redirected? = FalseExampleTo check if ... Read More

Duplicate a MySQL Database without using mysqldump?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:44:21

813 Views

To duplicate a MySQL database, the syntax is as follows −create table yourdatabaseName1.yourTableName1 select * from yourdatabaseName2.yourTableName2;Let us first create a table −mysql> use sample; Database changed mysql> create table DemoTable101    -> (    -> Id int,    -> Name varchar(20)    -> ); Query OK, 0 rows affected ... Read More

Check if Caps Lock and Num Lock is on or off through Console in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:43:22

386 Views

To check if Caps Lock is on or off through Console, the code is as follows −Example Live Demousing System; public class Demo{    public static void Main(string[] args){       Console.WriteLine("The CAPS LOCK is on or not? "+ Console.CapsLock);    } }OutputThis will produce the following output −The CAPS ... Read More

How to use MySQL LIKE query to search a column value with % in it?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:41:59

932 Views

To search a column value with %, the syntax is as follows −select * from yourTableName  where yourColumnName LIKE '\%%';Let us first create a table −mysql> create table DemoTable1497    -> (    -> Name varchar(20)    -> ); Query OK, 0 rows affected (0.55 sec)Insert some records in the ... Read More

MySQL query to group results by date and display the count of duplicate values?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 05:40:38

587 Views

Let us first create a table −mysql> create table DemoTable1496    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> PassengerCode varchar(20),    -> ArrivalDate datetime    -> ); Query OK, 0 rows affected (0.85 sec)Insert some records in the table using insert command −mysql> insert ... Read More

Advertisements