AmitDiwan has Published 10744 Articles

MySQL query to calculate the days between two dates from different columns but similar rows

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 07:39:53

372 Views

Let us first create a table −mysql> create table DemoTable1471    -> (    -> EmployeeJoiningDate date,    -> EmployeeRelievingDate date    -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1471 values('2018-06-21', '2018-12-21'); Query OK, 1 row affected ... Read More

Select a field and if it's null, select another with MySQL?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 07:38:05

156 Views

For this, use COALESCE(). Let us first create a table −mysql> create table DemoTable1470    -> (    -> FirstName varchar(20),    -> Age int    -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1470 values('Robert', 23); Query ... Read More

Get the type referenced by the specified type handle in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 07:36:55

208 Views

To get the type referenced by the specified type handle, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Type type1 = typeof(short);       RuntimeTypeHandle typeHandle = Type.GetTypeHandle(type1);       Type type = Type.GetTypeFromHandle(typeHandle);   ... Read More

Remove index from a MySQL table

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 07:34:41

522 Views

To remove index from a MySQL table, the syntax is as follows −alter table yourTableName drop index `yourIndexName`;Let us first create a table −Mysql> create table DemoTable1469    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(40),    -> StudentAge int    -> ); ... Read More

Convert a specified value to an equivalent Boolean value in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 07:33:49

462 Views

To convert a specified value to an equivalent Boolean value, the code is as follows −Example Live Demousing System; using System.Globalization; public class Demo {    public static void Main() {       CultureInfo cultures = new CultureInfo("en-US");       String str = "true";       Console.WriteLine("Converted bool ... Read More

Delete rows with duplicate and similar content & get row with maximum number with MySQL select statement?

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 07:29:09

102 Views

Let us first create a table −mysql> create table DemoTable1468    -> (    -> Id int,    -> Name varchar(20),    -> Age int    -> ); Query OK, 0 rows affected (1.21 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1468 values(100, 'Chris', 23); ... Read More

Gets or sets the value in HybridDictionary with specified key in C#

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 07:28:29

147 Views

To get or set the value in HybridDictionary with specified key, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo {    public static void Main() {       HybridDictionary myDict = new HybridDictionary();       myDict.Add("1", "Tablet");       myDict.Add("2", "Desktop");   ... Read More

Get rows that have common value from the same table with different id in MySQL

AmitDiwan

AmitDiwan

Updated on 10-Dec-2019 07:13:42

908 Views

For this, you can use GROUP BY HAVING clause. Let us first create a table −mysql> create table DemoTable1467    -> (    -> Id int,    -> Name varchar(20)    -> ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert ... Read More

Gets or sets the value at the specified key in StringDictionary in C#

AmitDiwan

AmitDiwan

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

118 Views

To get or set the value at the specified key in StringDictionary, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo {    public static void Main() {       StringDictionary myDict = new StringDictionary();       myDict.Add("1", "Tablet");       myDict.Add("2", "Desktop"); ... Read More

Fastest way to insert with multiple values in a single MySQL query?

AmitDiwan

AmitDiwan

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

579 Views

Do not use the below query for this −insert into yourTableName values(yourValue1, yourValue2, ...N); insert into yourTableName values(yourValue1, yourValue2, ...N); insert into yourTableName values(yourValue1, yourValue2, ...N); . . . NYou can use below query as the fastest way to insert with multiple values in a single query −insert into yourTableName ... Read More

Advertisements