Run MySQL Statement Without Termination Semicolon

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

427 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

488 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

154 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

208 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

1K+ 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

Synchronization of ArrayList in Chash

Ankith Reddy
Updated on 22-Jun-2020 10:52:04

328 Views

Use the ArrayList.Synchronized Method in C# for synchronization of ArrayList in C#.Let us see an example to lock the collection using SyncRoot property in C# −ArrayList arr = new ArrayList(); lock(arr.SyncRoot) {    foreach (object ele in arr) {    } }The following is the complete example to check the synchronization status of ArrayList −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       ArrayList arr1 = new ArrayList();       arr1.Add("One");       arr1.Add("Two");       arr1.Add("Three");       arr1.Add("Four");       arr1.Add("Five");     ... Read More

Restrictions on Rows and Columns in MySQL Queries without Table List

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

119 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

788 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”

Create Table SQL Query in SAP HANA

John SAP
Updated on 22-Jun-2020 10:48:44

9K+ Views

In below SQL query, you can see a create table command in SQL editor to create a new table with name-“Demo_HANA” in schema name AA_HANA11 with column names- ID and NAME and corresponding data types. In the below example, we have defined ID as “Primary Key” which means it is unique and not null.Create Table Demo_HANA (    ID INTEGER,    NAME VARCHAR(10),    PRIMARY KEY (ID) );

Advertisements