MySQL EXPLAIN gives a query execution plan. EXPLAIN can be used in the beginning with SELECT, INSERT, DELETE, REPLACE, and UPDATE.To avoid the complete table scan in database, you need to use index. Let us first create a table −mysql> create table DemoTable1488 -> ( -> StudentId int, -> StudentName varchar(20), -> StudentAge int -> ); Query OK, 0 rows affected (2.18 sec)Here is the query to create index −mysql> create index student_id_index on DemoTable1488(StudentId); Query OK, 0 rows affected (0.90 sec) Records: 0 Duplicates: 0 Warnings: 0insert into DemoTable1488 valueInsert some records in the ... Read More
To create a shallow copy of SortedList object, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args){ SortedList list = new SortedList(); list.Add("A", "Jacob"); list.Add("B", "Sam"); list.Add("C", "Tom"); list.Add("D", "John"); list.Add("E", "Tim"); list.Add("F", "Mark"); list.Add("G", "Gary"); list.Add("H", "Nathan"); list.Add("I", "Shaun"); list.Add("J", "David"); Console.WriteLine("SortedList elements..."); foreach(DictionaryEntry d in list){ ... Read More
For this, you can use ORDER BY along with some aggregate function right(). Let us first create a table −mysql> create table DemoTable1487 -> ( -> StudentCode text -> ); Query OK, 0 rows affected (0.91 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1487 values('560'); Query OK, 1 row affected (0.36 sec) mysql> insert into DemoTable1487 values('789'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1487 values('STUDENT78'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1487 values('John89'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1487 ... Read More
For this, you can use ORDER BY with LIMIT. Here, LIMIT is used to set the limit (count) of records you want to fetch. Let us first create a table −mysql> create table DemoTable1486 -> ( -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> StudentName varchar(20) -> ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1486(StudentName) values('Chris Brown'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1486(StudentName) values('David Miller'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1486(StudentName) values('John Doe'); ... Read More
To play beep sound through Console, the code is as follows −Example Live Demousing System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); Console.WriteLine("Beep sound through Console"); Console.Beep(); } }OutputThis will produce the following output −Displaying standard output stream... Standard Output Stream = System.IO.TextWriter+SyncTextWriter Beep sound through ConsoleExampleLet us now see another example − Live Demousing System; public class Demo { public static void Main(String[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard ... Read More
To perform a specified action on each element of the List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void demo(int s){ s = s * 10; Console.WriteLine(s); } public static void Main(String[] args){ List list = new List(); list.Add(25); list.Add(50); list.Add(75); list.Add(100); list.Add(200); list.Add(250); list.Add(275); list.Add(300); Console.WriteLine("List..."); foreach (int ... Read More
To insert the elements of a collection into the List at the specified index, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(String[] args){ string[] strArr = { "John", "Tom", "Kevin", "Mark", "Gary" }; List list = new List(strArr); Console.WriteLine("Elements in a List..."); foreach(string str in list){ Console.WriteLine(str); } strArr = new string[] { "Demo", "Text" }; Console.WriteLine("Inserted new elements in a range..."); ... Read More
To get TypeCode in C#, the code is as follows −Example Live Demousing System; public class Demo { public static void Main(){ string s = "Demo"; Console.WriteLine("String = " +s); Console.WriteLine("String Type = " +s.GetType()); Console.WriteLine("GetTypeCode = " +s.GetTypeCode()); } }OutputThis will produce the following output −String = Demo String Type = System.String GetTypeCode = StringExampleLet us now see another example − Live Demousing System; public class Demo { public static void Main(){ int i = 100; double d = 5.26d; ... Read More
To get the standard input stream through Console, the code is as follows −Example Live Demousing System; public class Demo { public static void Main(string[] args){ Console.WriteLine("Displaying standard input stream..."); Console.WriteLine("Standard Input Stream = "+Console.In); } }OutputThis will produce the following output −Displaying standard input stream... Standard Input Stream = System.IO.TextReader+SyncTextReaderExampleLet us now see an example to display standard output stream − Live Demousing System; public class Demo { public static void Main(string[] args){ Console.WriteLine("Displaying standard output stream..."); Console.WriteLine("Standard Output Stream = "+Console.Out); } }OutputThis will ... Read More
To get the remaining elements of the Tuple, the Rest property is used. The code is as follows −Example Live Demousing System; public class Demo { public static void Main(String[] args){ var tuple1 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500, 2000); var tuple2 = Tuple.Create(75, 200, 500, 700, 100, 1200, 1500, 2000); Console.WriteLine("Is Tuple1 equal to Tuple2? = "+tuple1.Equals(tuple2)); Console.WriteLine("HashCode of Tuple1 = "+tuple1.GetHashCode()); Console.WriteLine("HashCode of Tuple2 = "+tuple2.GetHashCode()); Console.WriteLine("Tuple1 Item 1st = "+tuple1.Item1); Console.WriteLine("Tuple2 Item 1st ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP