Multicolumn UNIQUE indexes can also be removed in the same as we remove UNIQUE constraint from the table.ExampleIn this example, with the following query we have removed the multicolumn UNIQUE indexes on table ‘employee’ −mysql> DROP index id_fname_lname on employee; Query OK, 0 rows affected (0.30 sec) Records: 0 Duplicates: 0 Warnings: 0The removal of UNIQUE indexes can be observed from the result sets of the following query −mysql> show index from employee; Empty set (0.00 sec) mysql> describe employee; +------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | ... Read More
For the upper triangular matrix, set all the elements below the main diagonal to zero.Set the following condition −if (i = j) Console.Write(A[i, j] + "\t"); else Console.Write("0\t"); } } Console.ReadLine(); } }OutputEnter number of rows and columns of the matrix Enter elements: Upper Triangular Matrix
CREATE UNIQUE INDEX statement can also be used to apply the UNIQUE constraint to the field of an existing MySQL table. The syntax of it is as follows −CREATE UNIQUE INDEX index_name ON table_name(Column_name);ExampleSuppose we have the following table named ‘Test5’ and we want to add UNIQUE constraint to the column ‘ID’ then it can be done with the help of CREATE UNIQUE INDEX command as follows −mysql> DESCRIBE TEST5; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | ID | int(11) | YES | ... Read More
SHOW INDEX statement is used to check the indexes created by a UNIQUE constraint on a MySQL table.SyntaxSHOW INDEX from table_name;ExampleSuppose we have the table ‘empl’ which have a UNIQUE constraint on column ‘empno’.mysql> describe empl; +--------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+-------------+------+-----+---------+-------+ | empno | int(11) | YES | UNI | NULL | | | F_name | varchar(20) | YES | | NULL | | +--------+-------------+------+-----+---------+-------+ 2 rows in set (0.23 sec)Now as we know that ... Read More
Create a thread first and start it −// new thread Thread thread = new Thread(c.display); thread.Start();Now display the thread and set a stop function to stop the working of the thread −public void display() { while (!flag) { Console.WriteLine("It's Working"); Thread.Sleep(2000); } } public void Stop() { flag = true; } }ExampleThe following is the complete code to learn how to kill a thread in C#.Live Demousing System; using System.Threading.Tasks; using System.Threading; class Demo { static void Main(string[] args){ MyClass c = new MyClass(); ... Read More
We can apply the UNIQUE constraint to a column of an existing MySQL table with the help of ALTER TABLE statement.SyntaxALTER TABLE table_name MODIFY colum_name datatype UNIQUE; OR ALTER TABLE table_name ADD UNIQUE (colum_name);ExampleSuppose we have the following table named ‘Test4’ and we want to add UNIQUE constraint to the column ‘Name’ then it can be done with the help of ALTER TABLE command as follows −mysql> DESCRIBE test4; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | ID ... Read More
To work with threads, add the following namespace in your code −using System.Threading;Firstly, you need to create a new thread in C# −Thread thread = new Thread(threadDemo);Above, threadDemo is our thread function.Now pass a parameter to the thread −thread.Start(str);The parameter set above is −String str = "Hello World!";ExampleLet us see the complete code to pass a parameter to a thread in C#.Live Demousing System; using System.Threading; namespace Sample { class Demo { static void Main(string[] args) { String str = "Hello World!"; // new thread ... Read More
To pause a thread in C#, use the sleep() method.You need to set the milliseconds for which you want the thread to pause, for example, for 5 seconds, use −Thread.Sleep(5000);ExampleLet us see how to loop through and set the sleep method to pause the thread.Live Demousing System; using System.Threading; namespace Sample { class Demo { static void Main(string[] args) { for (int i = 0; i < 10; i++) { Console.WriteLine("Sleep for 1 second!"); Thread.Sleep(1000); } ... Read More
Basic Arithmetic Operators in C#, include the following −OperatorDescription+Adds two operands-Subtracts the second operand from the first*Multiplies both operands/Divides the numerator by de-numerator%Modulus Operator and remainder of after an integer division++Increment operator increases integer value by one--Decrement operator decreases integer value by oneTo add, use the Addition Operator −num1 + num2;In the same way, it works for Subtraction, Multiplication, Division, and other operators.ExampleLet us see a complete example to learn how to implement Arithmetic operators in C#.Live Demousing System; namespace Sample { class Demo { static void Main(string[] args) { int num1 ... Read More
To return a string from a JavaScript function, use the return statement in JavaScript.ExampleYou need to run the following code to learn how to return a string using return statement − function concatenate(name, subject) { var val; val = name + subject; return val; } function DisplayFunction() { var result; result = concatenate('Amit', ' Java'); document.write (result ); } Click the following button to call the function
 Data Structure
 Networking
 RDBMS
 Operating System
 Java
 iOS
 HTML
 CSS
 Android
 Python
 C Programming
 C++
 C#
 MongoDB
 MySQL
 Javascript
 PHP