AmitDiwan has Published 10744 Articles

MySQL number-string formatting to pad zeros on the left of a string with numbers after a slash

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:20:41

302 Views

Let us first create a table −mysql> create table DemoTable1369     -> (     -> BatchId varchar(20)     -> ); Query OK, 0 rows affected (0.46 sec)Insert some records in the table using insert command. We have inserted numbers here separated by a slash −mysql> insert into ... Read More

Math.Sign() Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:19:12

1K+ Views

The Math.Sign() method in C# is used to return an integer that indicates the sign of a number.MethodsThe Math.Sign() overloads the following methods −Math.Sign(Int16) Math.Sign(Int32) Math.Sign(Int64) Math.Sign(SByte) Math.Sign(Single) Math.Sign(Decimal) Math.Sign(Double)ExampleLet us now see an example to implement Math.Sign() method −using System; public class Demo {    public static void Main(){ ... Read More

MySQL query to append a number of stars based on string length?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:17:51

237 Views

For this, you can use RPAD(). Let us first create a table −mysql> create table DemoTable1626     -> (     -> Name varchar(20)     -> ); Query OK, 0 rows affected (0.37 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1626 values('Chris'); Query ... Read More

Adding dash between spaces in field name in MySQL?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:16:51

425 Views

You can use REPLACE() for this. Let us first create a table −mysql> create table DemoTable1625     -> (     -> FullName varchar(20)     -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1625 values('John Doe'); ... Read More

Math.Round() Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:16:22

8K+ Views

The Math.Round() method in C# rounds a value to the nearest integer or to the specified number of fractional digits.MethodsThe following are the methods overloaded by Math.Round() −Math.Round(Double) Math.Round(Double, Int32) Math.Round(Double, Int32, MidpointRounding) Math.Round(Double, MidpointRounding) Math.Round(Decimal) Math.Round(Decimal, Int32) Math.Round(Decimal, Int32, MidpointRounding) Math.Round(Decimal, MidpointRounding)ExampleLet us now see an example to implement ... Read More

SELECT * WHERE var == [one of many alternatives] in MySQL?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:15:50

262 Views

Use IN() for select * where var== [one of many alternatives]. Let us first create a table −mysql> create table DemoTable1624     -> (     -> ClientId int,     -> ClientName varchar(20)     -> ); Query OK, 0 rows affected (0.39 sec)Insert some records in the ... Read More

How to sort an alphanumeric column with different lengths in MySQL?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:14:54

172 Views

Let us first create a table −mysql> create table DemoTable1623     -> (     -> StudentCode varchar(20)     -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1623 values('STU-MIT-143'); Query OK, 1 row affected (0.19 sec) ... Read More

Int16.Equals Method in C# with Examples

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:13:54

148 Views

The Int16.Equals() method in C# is used to return a value indicating whether this instance is equal to a specified object or Int16.SyntaxFollowing is the syntax −public bool Equals (short ob); public override bool Equals (object ob);Above, the parameter ob for the 1st syntax is an Int16 value to compare ... Read More

Array.FindAll() Method in C#

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:11:00

2K+ Views

The Array.FindAll() method in C# is used to retrieve all the elements that match the conditions defined by the specified predicate.SyntaxFollowing is the syntax −public static T[] FindAll (T[] array, Predicate match);ExampleLet us now see an example to implement the Array.FindAll() method −using System; public class Demo{    public static ... Read More

How to search for the exact string value in MySQL?

AmitDiwan

AmitDiwan

Updated on 08-Nov-2019 11:10:21

182 Views

To search for the exact string value, use the concept of COLLATE. Let us first create a table −mysql> create table DemoTable1620     -> (     -> Subject varchar(20)     -> ); Query OK, 0 rows affected (0.42 sec)Insert some records in the table using insert command ... Read More

Advertisements