Add Column from Select Query with Row Count in MySQL

AmitDiwan
Updated on 05-Nov-2019 07:30:01

353 Views

For this, you can use MySQL row_number(). Let us first create a table −mysql> create table DemoTable1342    -> (    -> Score int    -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1342 values(80); Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable1342 values(98); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1342 values(78); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1342 values(89); Query OK, 1 row affected (0.07 sec)Display all records from the table using select statement −mysql> select ... Read More

jQuery File Selector

AmitDiwan
Updated on 05-Nov-2019 07:24:41

607 Views

The :file selector in jQuery is used to select all input elements with type=”file”.SyntaxThe syntax is as follows −$(":file")ExampleLet us now see an example to implement the :file() selector −    .demo {       background-color: blue;       color: white;       font-size: 16px;       border: 2px blue dashed;    }    $(document).ready(function(){       $(":file").addClass("demo");    }); Job Application Applicant Name: Rank: Resume: OutputThis will produce the following output −

Convert FromBase64String to String in C#

AmitDiwan
Updated on 05-Nov-2019 07:23:41

3K+ Views

The Convert.FromBase64String(String) method in C# converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.SyntaxFollowing is the syntax −public static byte[] FromBase64String (string str);Above, the parameter str is the string to convert.ExampleLet us now see an example to implement the Convert.FromBase64String(String) method −using System; public class Demo {    public static void Main(){       byte[] val1 = {5, 10, 15, 20, 25, 30};       string str = Convert.ToBase64String(val1);       Console.WriteLine("Base 64 string: '{0}'", str);       byte[] val2 = Convert.FromBase64String(str);       Console.WriteLine("Converted byte ... Read More

Fetch Substring After Last Dot in MySQL

AmitDiwan
Updated on 05-Nov-2019 07:23:14

2K+ Views

To fetch the substring after last dot, use substring_index(). Let us first create a table −mysql> create table DemoTable1341    -> (    -> Value varchar(60)    -> ); Query OK, 0 rows affected (0.75 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1341 values('John.123.@gmail.com' ); Query OK, 1 row affected (0.27 sec) mysql> insert into DemoTable1341 values('Carol.Taylor.gmail') ; Query OK, 1 row affected (0.24 sec) mysql> insert into DemoTable1341 values('C.MyFolder.Location') ; Query OK, 1 row affected (0.10 sec)Display all records from the table using select statement −mysql> select * from DemoTable1341;This will produce the following ... Read More

jQuery Even Selector

AmitDiwan
Updated on 05-Nov-2019 07:21:45

176 Views

The :even selector in jQuery is used to select even elements i.e. with even index number.Note − The :even selector deprecated in jQuery 3.4SyntaxThe syntax is as follows −$(":even")ExampleLet us now see an example to implement the :even() selector −    .one {       background-color: blue;       color: white;       font-size: 18px;       border: 2px blue dashed;    }    $(document).ready(function(){       $("tr:even").addClass("one");    }); Result Rank Points Player 1 100 Virat Kohli 2 80 Steve Smith 3 75 David Warner 4 60 Kane Williamson 5 50 Ben Stokes 6 45 Rohit Sharma OutputThis will produce the following output −

CharEnumerator ToString Method in C#

AmitDiwan
Updated on 05-Nov-2019 07:20:36

68 Views

The CharEnumerator.ToString() method in C# gets a string that represents the current object.SyntaxFollowing is the syntax -public virtual string ToString();ExampleLet us now see an example to implement the CharEnumerator.ToString() method −using System; public class Demo {    public static void Main(){       string strNum = "This is it!";       CharEnumerator ch = strNum.GetEnumerator();       Console.WriteLine("HashCode = "+ch.GetHashCode());       Console.WriteLine("Get the Type = "+ch.GetType());       Console.WriteLine("String representation = "+ch.ToString());       while (ch.MoveNext())          Console.Write(ch.Current + " ");       ch.Reset();       Console.WriteLine();   ... Read More

Check If a Date Has Passed in MySQL

AmitDiwan
Updated on 05-Nov-2019 07:19:46

1K+ Views

Let us first create a table −mysql> create table DemoTable1340    -> (    -> Deadline date    -> ); Query OK, 0 rows affected (0.43 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1340 values('2019-09-18'); Query OK, 1 row affected (0.52 sec) mysql> insert into DemoTable1340 values('2019-09-23'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1340 values('2018-12-24'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1340 values('2016-11-01'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1340 values('2019-09-28'); Query OK, 1 row affected (0.18 sec)Display all records from the table ... Read More

jQuery Enabled Selector

AmitDiwan
Updated on 05-Nov-2019 07:18:35

215 Views

The :enabled selector in jQuery is used to select all enabled input elements.SyntaxThe syntax is as follows −$(":enabled")ExampleLet us now see an example to implement the :enabled() selector −    .one {       background-color: orange;       font-size: 16px;       border: 2px blue dashed;    }    $(document).ready(function(){       $(":enabled").addClass("one");    }); Result Username: Password: OutputThis will produce the following output −

MySQL Random Rows Sorted by Specific Column Name

AmitDiwan
Updated on 05-Nov-2019 07:17:29

312 Views

Let us first create a table −mysql> create table DemoTable1339    -> (    -> Name varchar(30),    -> Score int    -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1339 values('Chris', 56); Query OK, 1 row affected (0.36 sec) mysql> insert into DemoTable1339 values('Bob', 46); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1339 values('Adam', 78); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1339 values('John', 90); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1339 values('Carol', 98); Query OK, 1 ... Read More

Tuple T1, T2, T3 Class in C#

AmitDiwan
Updated on 05-Nov-2019 07:17:27

149 Views

The Tuple class represents a 3-tuple, which is called triple. A tuple is a data structure that has a sequence of elements.It is used in −Easier access to a data set.Easier manipulation of a data set.To represent a single set of data.To return multiple values from a methodTo pass multiple values to a methodIt has three properties −Item1 − Get the value of the current Tuple object's first component.Item2 −Get the value of the current Tuple object's second component.Item3 − Get the value of the current Tuple object's third component.ExampleLet us now see an example to implement the 3-tuple in C# ... Read More

Advertisements