Convert Subqueries to LEFT JOIN

Sai Nath
Updated on 22-Jun-2020 10:55:57

2K+ Views

To make it understand we are using the data from the following tables −mysql> Select * from customers; +-------------+----------+ | Customer_Id | Name     | +-------------+----------+ | 1           | Rahul    | | 2           | Yashpal  | | 3           | Gaurav   | | 4           | Virender | +-------------+----------+ 4 rows in set (0.00 sec) mysql> Select * from reserve; +------+------------+ | ID   | Day        | +------+------------+ | 1    | 2017-12-30 | | ... Read More

Linked List in Chash

Samual Sam
Updated on 22-Jun-2020 10:55:35

2K+ Views

System.Collections.Generic namespace is available in C# for LinkedList. The LinkedList class allows insertion and deletion of elements from the list at a fast pace.C# LinkedList class uses the concept of linked list. It allows us to insert and delete elements fastly. It can have duplicate elements. It is found in System.Collections.Generic namespace.Here is an example −Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       LinkedList < string > l = new LinkedList < string > ();       l.AddLast("one");       l.AddLast("two");       l.AddLast("three");     ... Read More

Run MySQL Statement Without Termination Semicolon

Ramu Prasad
Updated on 22-Jun-2020 10:55:03

490 Views

With the help of \G or \g option just at the end of the MySQL statement, we can run it without the semicolon. Consider the example below −mysql> Select * from Stock_item\G *************************** 1. row *************************** item_name: Calculator     Value: 15  Quantity: 89 *************************** 2. row *************************** item_name: Notebooks     Value: 63  Quantity: 40 *************************** 3. row *************************** item_name: Pencil     Value: 15  Quantity: 40 *************************** 4. row *************************** item_name: Pens   Value : 65 Quantity: 32 *************************** 5. row *************************** item_name: Shirts     Value: 13  Quantity: 29 *************************** 6. row *************************** item_name: Shoes     ... Read More

Check if String is Palindrome Using Chash

Ankith Reddy
Updated on 22-Jun-2020 10:54:50

529 Views

Let’s say we need to find that the following string is Palindrome or not −str = "Level";For that, convert the string into character array to chec each character −char[] ch = str.ToCharArray();Now find the reverse −Array.Reverse(ch);Use the Equals method to find whether the reverse is equal to original array or not −bool res = str.Equals(rev, StringComparison.OrdinalIgnoreCase);The following is the complete code −Example Live Demousing System; namespace Demo {    class Program {       static void Main(string[] args) {          string str, rev;          str = "Level";          char[] ch ... Read More

Find the File Using Chash

George John
Updated on 22-Jun-2020 10:53:53

172 Views

Use the GetDirectories in C# to get a list of sub-folder that appears first −Directory.GetDirectoriesNow loop through those directories and repeat the process for the sub folder.string path = @"d:/New/Myfile"; string[] myDir = Directory.GetDirectories(path, "xml", SearchOption.AllDirectories); Console.WriteLine(myDir.Length.ToString()); foreach (string res in myDir) Console.WriteLine(res);

Convert Subqueries to RIGHT JOIN

Arjun Thakur
Updated on 22-Jun-2020 10:52:59

233 Views

To make it understand we are using the data from the following tables −mysql> Select * from Customers; +-------------+----------+ | Customer_Id | Name     | +-------------+----------+ | 1           | Rahul    | | 2           | Yashpal  | | 3           | Gaurav   | | 4           | Virender | +-------------+----------+ 4 rows in set (0.00 sec) mysql> Select * from Reserve; +------+------------+ | ID   | Day        | +------+------------+ | 1    | 2017-12-30 | | ... Read More

Merge Two Dictionaries in C#

Chandu yadav
Updated on 22-Jun-2020 10:52:52

2K+ Views

Set the two dictionaries −Dictionary < string, int > dict1 = new Dictionary < string, int > (); dict1.Add("laptop", 1); dict1.Add("desktop", 2); Dictionary < string, int > dict2 = new Dictionary < string, int > (); dict2.Add("desktop", 3); dict2.Add("tablet", 4); dict2.Add("mobile", 5);Now use HashSet and UnionWith() method to merge the two dictionaries −HashSet < string > hSet = new HashSet < string > (dict1.Keys); hSet.UnionWith(dict2.Keys);Here is the complete code −Exampleusing System; using System.Collections.Generic; class Program {    static void Main() {       Dictionary < string, int > dict1 = new Dictionary < string, int > ();     ... Read More

Deadlock and Starvation in Chash

George John
Updated on 22-Jun-2020 10:52:20

2K+ Views

Deadlock occurs when a resource is locked by a thread and is required by another thread at the same time. This problem occur frequenty in a multiprocessing system.It can occur when two or more threads wait for a resource that belon to another thread. Here is an example −Thread OneThread TwoTakes Lock PTakes Lock QRequests Lock QRequests Lock PThread One will not get Lock Q since it belongs to Thread Two. In the same way, Thread Two won’t get Lock P since its original owner is Thread One.Deadlocks can also be a three-way deadlock that occurs if three threads and ... Read More

Restrictions on Rows and Columns in MySQL Queries without Table List

vanithasree
Updated on 22-Jun-2020 10:51:26

139 Views

The restriction on MySQL query having a notable list is that it can return, as a result, exactly one row but that result can contain multiple columns.Examplemysql> Select 65/NULL,65+NULL,65*NULL,65-NULL,65%NULL; +------------+--------------+-------------+-------------+---------+ | 65/NULL    | 65+NULL      | 65*NULL     | 65-NULL     | 65%NULL | +------------+--------------+-------------+-------------+---------+ |       NULL |         NULL |        NULL |        NULL |    NULL | +------------+--------------+-------------+-------------+---------+ 1 row in set (0.00 sec)In the above example, we can see that MySQL returns only one row with five columns, having the result of five expressions, as a result when we do not have any table list in the statement.

Execution Time of SQL Query in HANA Studio

John SAP
Updated on 22-Jun-2020 10:49:45

835 Views

When a SQL query is executed, you can see the confirmation that the query is executed in time duration and also with server processing time. In this scenario, you can see the time taken by SAP HANA processor to create a new table in the HANA database as below −“Statement 'Create Table Demo_HANA ( ID INTEGER, NAME VARCHAR(10), PRIMARY KEY (ID) )' successfully executed in 3 ms 117 µs  (server processing time − 2 ms 458 µs) - Rows Affected − 0”

Advertisements