To create a Queue from another collection, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main() { Queue queue = new Queue(); queue.Enqueue("One"); queue.Enqueue("Two"); queue.Enqueue("Three"); Console.WriteLine("Queue elements..."); foreach(string str in queue) { Console.WriteLine(str); } Console.WriteLine("Array elements..."); Queue arr = new Queue(queue.ToArray()); foreach(string str in arr) { Console.WriteLine(str); } ... Read More
Use IF() method as an alternative to CASE WHEN in MySQL. Let us first create a table −mysql> create table DemoTable1593 -> ( -> PlayerScore int -> ); Query OK, 0 rows affected (0.44 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1593 values(78); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1593 values(0); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1593 values(89); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1593 values(0); Query OK, 1 row affected (0.16 sec)Display all records from the table using ... Read More
To count the total number of elements in the List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(String[] args) { List list = new List(); list.Add("One"); list.Add("Two"); list.Add("Three"); list.Add("Four"); list.Add("Five"); Console.WriteLine("Elements in List1..."); foreach (string res in list) { Console.WriteLine(res); } Console.WriteLine("Count of elements in list = "+list.Count); list.Clear(); ... Read More
For this, set conditions using MySQL IF(). Let us first create a table −mysql> create table DemoTable1592 -> ( -> StudentMarks int -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1592 values(56); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1592 values(NULL); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1592 values(98); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable1592 values(0); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1592 values(75); Query OK, 1 row affected ... Read More
For this, you can use TIME_FORMAT(). Let us first create a table −mysql> create table DemoTable1591 -> ( -> ArrivalTime varchar(20) -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1591 values('1620'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable1591 values('2345'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable1591 values('2210'); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select * from DemoTable1591;This will produce the following output −+-------------+ | ArrivalTime | +-------------+ ... Read More
You can find the option to either insert a row into a table or change the content of the table using the Table tools/Table display services
The StringDictionay class implements a hash table with the key and the value strongly typed to be strings rather than objects.Following are the properties of the StringDictionary class −Sr.NoProperty & Description1CountGets the number of key/value pairs in the StringDictionary.2IsSynchronizedGets a value indicating whether access to the StringDictionary is synchronized (thread safe).3tem[String]Gets or sets the value associated with the specified key.4KeysGets a collection of keys in the StringDictionary..5SyncRootGets an object that can be used to synchronize access to the StringDictionary.6ValuesGets a collection of values in the StringDictionary.Following are some of the methods of the StringDictionary class −Sr.NoMethods & Description1Add(String, String)Adds an ... Read More
Following is the syntax to combine two fields in MySQL −alter table yourTableName add column yourColumnName dataType; update yourTableName set yourAddedColumnName =concat(yourColumnName1, ' ', yourColumnName2);Let us first create a table −mysql> create table DemoTable1590 -> ( -> FirstName varchar(20), -> LastName varchar(20) -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1590 values('Adam', 'Smith'); Query OK, 1 row affected (0.45 sec) mysql> insert into DemoTable1590 values('John', 'Doe'); Query OK, 1 row affected (0.42 sec) mysql> insert into DemoTable1590 values('David', 'Miller'); Query OK, 1 row affected ... Read More
You cannot create database with numeric name as shown below −mysql> create database 1233;This will produce the following output −ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1233' at line 1To create a database with numeric name, you need to use backticks around the database name −create database yourDatabaseName;Let us implement the above syntax −mysql> create database `1233`; Query OK, 1 row affected (0.20 sec)Now you can switch to the same database −mysql> use `1233`; Database changed
To get synchronize access to HybridDictionary, the code is as follows −Exampleusing 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 Wearables"); dict1.Add("D", "Pet Supplies"); dict1.Add("E", "Clothing"); dict1.Add("F", "Footwear"); Console.WriteLine("HybridDictionary1 elements..."); foreach(DictionaryEntry d in dict1) { Console.WriteLine(d.Key + " " + d.Value); } Console.WriteLine("Is the HybridDictionary1 ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP