We can update MySQL table after removing a particular string from the values of a column by using TRIM() function along with UPDATE clause. Following the example from ‘examination_btech’ table will make it clearer −ExampleSuppose if we want to delete the values ‘(CSE)’, from last, of column ‘Course’ and want to update the table too then it can be done with the help of the following query −mysql> Update examination_btech SET Course = TRIM(Trailing '(CSE)' FROM Course); Query OK, 10 rows affected (0.13 sec) mysql> Select * from examination_btech; +-----------+----------+--------+ | RollNo | Name | Course | +-----------+----------+--------+ | 201712001 | Rahul ... Read More
C# provides two techniques to implement static polymorphism −Function overloadingOperator overloadingFunction OverloadingTwo or more than two methods having the same name but different parameters is what we call function overloading in C#.Function overloading in C# can be performed by changing the number of arguments and the data type of the arguments.Let’s say you have a function that prints multiplication of numbers, then our overloaded methods will have the same name but different number of arguments −public static int mulDisplay(int one, int two) { } public static int mulDisplay(int one, int two, int three) { } public static int mulDisplay(int one, ... Read More
The Array.Lenth property in C# is used to find the length of the array.Let’s set the array class first −Array arr = Array.CreateInstance(typeof(String), 3); arr.SetValue("Electronics", 0); arr.SetValue("Clothing", 1); arr.SetValue("Appliances", 2);Now since the array’s length is 3, the Length property will give the result 3 −arr.LengthThe following is the code to implement Array.Length property of array class −Example Live Demousing System; using System.Collections.Generic; using System.Linq; using System.Text; namespace lower { class Program { static void Main(string[] args) { Array arr = Array.CreateInstance(typeof(String), 3); arr.SetValue("Electronics", 0); ... Read More
It can be done with the SHOW COLUMNS statement. Its Syntax would be as follows −SyntaxSHOW COLUMNS FROM db_name.tab_nameHere, tab_name is the name of the table from which we want to see the list of columns.Db_name is the name of the database, in which the table is storedExampleIn the example we are currently using the database ‘query’ and getting the list of columns from table named ‘arena’ stored in mysql ‘database’ −mysql> SHOW COLUMNS FROM mysql.arena\G *************************** 1. row *************************** Field: id Type: int(10) unsigned zerofill Null: NO Key: PRI Default: NULL Extra: auto_increment ... Read More
The Array.LongLength property gets a 64-bit integer that represents the total number of elements in all the dimensions of the Array.Let’s say your array of long data type is −long[,] arr1= new long[15, 35];Use the LongLength property to get an integer representing the total number of elements in all dimensions of the Array −arr1.LongLengthLet us see an example to implement the Array.LongLength property of array class −Example Live Demousing System; class Program { static void Main() { long[,] arr1= new long[15, 35]; long len1 = arr1.GetLongLength(0); Console.WriteLine(len1); Console.WriteLine(arr1.LongLength); } }Output15 525
For this purpose, we create an object of HashMap class which is defined in java.util packageMap map = new HashMap();This hashmap object associates each digit with its corresponding word representationmap.put("0", "zero");Initialize an empty string object.String newstr="";Next, run a for loop over the length of given string and extract each character by substring() method of String class.Check if the character exists as a key in map object by containsKey() method. If it does, using it as key, obtain its value component in map and appenf\d to the new string. If not append the character itself to the new string. The complete code ... Read More
For adding a new user to MySQL, we just need to add a new entry to the user table in the database mysql. To illustrate it we are using the following example −ExampleThe following program is an example of adding a new user guest with SELECT, INSERT and UPDATE privileges with the password guest123; the SQL query is −root@host# mysql -u root -p Enter password:******* mysql> use mysql; Database changed mysql> INSERT INTO user (host, user, password, select_priv, insert_priv, update_priv) VALUES ('localhost', 'guest', PASSWORD('guest123'), 'Y', 'Y’, 'Y'); Query OK, 1 row affected (0.20 sec) mysql> FLUSH PRIVILEGES; Query OK, ... Read More
Under Composition, if the parent object is deleted, then the child object also loses its status. The composition is a special type of Aggregation and gives a part-of relationship.For example, A Car has an engine. If the car is destroyed, the engine is destroyed as well.public class Engine { . . . } public class Car { Engine eng = new Engine(); ....... }Aggregation is a directional relation between objects in C#. It is the relationship between objects.For example, Employee and AddressAn Employee is associated with a single Department, whereas a Department can have more than one employee. Let ... Read More
In Dynamic binding, the compiler will not do type checking at compile time. At runtime, the checking is done.Use it to avoid the restriction of anonymous types to one method. This is only because the type name is visible only to the compiler; therefore, you cannot declare it as the return value of a method.Let us see an example −public dynamic GetAnonymousType() { return new { StudentName = "Jack", Subject = "Maths", }; }Above, the method is set to be dynamic, that would mean the compiler won’t do type checking at compile time −public dynamic GetAnonymousType() {}
The mechanism of linking a function with an object during compile time is called early binding. It is also called static binding. C# provides two techniques to implement static polymorphism i.e Function overloading and Operator overloading.Let us learn about Function Overloading with an example −You can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. You cannot overload function declarations that differ only by return type.The following is the complete example −Example Live Demousing System; ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP