How can we upload data into multiple MySQL tables by using mysqlimport?

varun
Updated on 20-Jun-2020 10:37:03

457 Views

With the help of mysqlimport we can upload data into multiple MySQL tables. It is illustrated in the example below −ExampleSuppose we want to upload the following data from two data files namely student1_tbl.txt −1     Saurav     11th 2     Sahil      11th 3     Digvijay   11thAnd House.txt1   Furniture 2   Television 3   RefrigeratorFollowings are MySQL tables into which we want to upload the above data −mysql> DESCRIBE Student1_tbl; +--------+-------------+------+-----+---------+-------+ | Field  | Type        | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | RollNo | int(11) ... Read More

In what cases, we cannot use MySQL TRIM() function?

Arjun Thakur
Updated on 20-Jun-2020 10:35:51

631 Views

Actually for using MySQL TRIM() function we must have to know the string which we want to trim from the original string. This becomes the major drawback of TRIM() in the cases where we want to trim the strings having different values. For example, suppose we want to get the output after trimming the last two characters from the strings but every string is having different characters at last two places.Examplemysql> Select * from Employee; +------+----------------+------------+-----------------+ | Id   | Name           | Address    | Department      | +------+----------------+------------+-----------------+ | 100  | Raman ... Read More

Java Regular Expression that doesn't contain a certain String.

Arnab Chakraborty
Updated on 20-Jun-2020 10:34:58

710 Views

Exampleimport java.util.regex.*; class PatternMatch{    public static void main(String args[]) {       String content = "I am a student";       String string = ".*boy.*";       boolean isMatch = Pattern.matches(string, content);       System.out.println("The line contains 'boy'?"+ isMatch);    } }Outputthe line contains 'boy'?falsematches()­­It is used to check if the whole text matches a pattern. Its output is boolean. It returns true if match is found otherwise false.This is one of simplest and easiest way of searching a String in a text using Regex .There is a another method compile() , if you want ... Read More

Iterators in C#

Samual Sam
Updated on 20-Jun-2020 10:30:53

394 Views

Iterator performs a custom iteration over a collection. It uses the yield return statement and returns each element one at a time. The iterator remembers the current location and in the next iteration the next element is returned.The following is an example −Example Live Demousing System; using System.Collections.Generic; using System.Linq; namespace Demo {    class Program {       public static IEnumerable display() {          int[] arr = new int[] {99, 45, 76};          foreach (var val in arr) {             yield return val.ToString();       ... Read More

How to write the first program in C#?

karthikeya Boyini
Updated on 20-Jun-2020 10:29:55

622 Views

The following is the first program in C# programming −Example Live Demousing System; namespace MyHelloWorldApplication {    class MyDemoClass {       static void Main(string[] args) {          // display text          Console.WriteLine("Hello World");          // display another text          Console.WriteLine("Welcome!");          Console.ReadKey();       }    } }OutputHello World Welcome!Let us see now what all it includes.using System; - the using keyword is used to include the System namespace in the program.namespace declaration - A namespace is a ... Read More

How to declare and initialize a dictionary in C#?

karthikeya Boyini
Updated on 20-Jun-2020 10:28:45

1K+ Views

Dictionary is a collection of keys and values in C#. Dictionary is included in the System.Collection.Generics namespace.To declare and initialize a Dictionary −IDictionary d = new Dictionary();Above, types of key and value are set while declaring a dictionary object. An int is a type of key and string is a type of value. Both will get stored in a dictionary object named d.Let us now see an example −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       IDictionary d = new Dictionary();       d.Add(1, 97);       ... Read More

How to declare and initialize a list in C#?

Samual Sam
Updated on 20-Jun-2020 10:28:04

14K+ Views

To declare and initialize a list in C#, firstly declare the list −List myList = new List()Now add elements −List myList = new List() {    "one",    "two",    "three", };Through this, we added six elements above.The following is the complete code to declare and initialize a list in C# −Example Live Demousing System; using System.Collections.Generic; class Program {    static void Main() {       // Initializing collections       List myList = new List() {          "one",          "two",          "three",          "four",          "five",          "size"       };       Console.WriteLine(myList.Count);    } }Output6

How to declare and initialize constant strings in C#?

karthikeya Boyini
Updated on 20-Jun-2020 10:27:16

11K+ Views

To set a constant in C#, use the const keyword. Once you have initialized the constant, on changing it will lead to an error.Let’s declare and initialize a constant string −const string one= "Amit";Now you cannot modify the string one because it is set as constant.Let us see an example wherein we have three constant strings. We cannot modify it after declaring −Example Live Demousing System; class Demo {    const string one= "Amit";    static void Main() {       // displaying first constant string       Console.WriteLine(one);       const string two = ... Read More

How to declare and instantiate Delegates in C#?

Samual Sam
Updated on 20-Jun-2020 10:26:30

484 Views

C# delegates are similar to pointers to functions, in C or C++. A delegate is a reference type variable that holds the reference to a method. The reference can be changed at runtime.Syntax for declaring Delegates −delegate Let us now see how to instantiate delegates in C#.Once a delegate type is declared, a delegate object must be created with the new keyword and be associated with a particular method. When creating a delegate, the argument passed to the new expression is written similar to a method call, but without the arguments to the method.public delegate void printString(string s); ... Read More

How to declare member function in C# interface?

karthikeya Boyini
Updated on 20-Jun-2020 10:22:19

249 Views

To declare member functions in interfaces in C# −public interface InterfaceName {    // interface members    void InterfaceMemberOne();    double InterfaceMembeTwo();    void InterfaceMemberThree() } public class ClassName: InterfaceName {    void InterfaceMemberOne() {       // interface member    } }Above we saw our interface members are −void InterfaceMemberOne(); double InterfaceMembeTwo(); void InterfaceMemberThree()We have then used it in the class for implementing interface −public class ClassName: InterfaceName {    void InterfaceMemberOne() {       // interface member    } }

Advertisements