The orderby is used in C# to sort elements in the collection based on specified fields in a particular order. The order can be ascending or descending.The following is our list with elements −List myList = new List(); // adding elements myList.Add("iOS by Apple"); myList.Add("Android by Google"); myList.Add("Symbian by Nokia");Now, use Orderby to order the elements in descending order −var myLen = from element in myList orderby element.Length descending select element;The following is the complete code −Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Demo { static void Main() { List myList = new ... Read More
PHP uses mysql_query function to delete an existing MySQL table. This function takes two parameters and returns TRUE on success or FALSE on failure. Its syntax is as follows −Syntaxbool mysql_query( sql, connection );Followings are the parameters used in this function −S. No.Parameter & Description1.SqlRequired - SQL query to delete an existing MySQL table2.connectionOptional - if not specified, then the last opened connection by mysql_connect will be used.
With the help of DROP VIEW statement, we can drop a MySQL view from the database. Its syntax would be as follows −SyntaxDROP VIEW [IF EXISTS] view_name;Here view_name is the name of the view which we want to delete from the database.ExampleSuppose if we want to drop a view named info_less then the following query will delete if −mysql> DROP VIEW IF EXISTS Info_less; Query OK, 0 rows affected (0.03 sec)
As we know that PHP provides us the function named mysql_query to delete an existing MySQL table.ExampleTo illustrate this we are deleting a table named ‘Tutorials_tbl’ with the help of PHP script in the following example − Creating MySQL Tables
As we know that views are a type of virtual tables and are the composition of tables too hence we can use the same query to get the definition of a view which we use to get the definition of a table. In other words, we can use SHOW CREATE statement to get the definition of a MySQL view. Its syntax would be as follows −SyntaxSHOW CREATE VIEW view_name;Here view_name is the name of the view of which we want to get the definition.ExampleThe following query will give the definition of a view named ‘info’ −mysql> Show Create View Info\G ... Read More
As we know that views are a type of virtual tables and are a composition of tables too hence we can use the same query to get the structure of a view which we use to get the structure of a table. In other words, we can use DESCRIBE statement to get the structure of a MySQL view. Its syntax would be as follows −SyntaxDESCRIBE view_name;Here, view_name is the name of the view of which we want to get the structure.ExampleSuppose we want to get the structure of a view named ‘Info’ then it can be done with the help, of the following query ... Read More
Call a method under Join method to join words −string.Join(" ", display())Now set a string array −string[] str = new string[5];Add individual elements −str[0] = "My"; str[1] = "name"; str[2] = "is"; str[3] = "Brad"; str[4] = "Pitt";And return the same string array from method −return str;The following is the complete code −Example Live Demousing System; public class Demo { public static void Main() { Console.WriteLine(string.Join(" ", display())); } static string[] display() { string[] str = new string[5]; // string array elements str[0] = "My"; str[1] = "name"; str[2] = "is"; str[3] = "Brad"; str[4] = "Pitt"; return str; } }OutputMy name is Brad Pitt
PHP uses a mysql_query function to insert data into an existing MySQL table. This function takes two parameters and returns TRUE on success or FALSE on failure. Its syntax is as follows −Syntaxbool mysql_query( sql, connection );Followings are the parameters used in this function −S. No.Parameter & Description1.SqlRequired - SQL query to insert data into an existing MySQL table2.connectionOptional - if not specified, then the last opened connection by mysql_connect will be used.
Firstly, set an array −string[] str = new string[]{ "Java", "HTML", "jQuery", "JavaScript", "Bootstrap" };To get the value of the last element, get the length and display the following value −str[str.Length - 1]The above returns the last element.Here is the complete code −Example Live Demousing System; public class Demo { public static void Main() { string[] str = new string[] { "Java", "HTML", "jQuery", "JavaScript", "Bootstrap" }; Console.WriteLine("Array..."); foreach(string res in str) { Console.WriteLine(res); } Console.WriteLine("Last element: "+str[str.Length - 1]); } }OutputArray... Java HTML jQuery JavaScript Bootstrap Last element: Bootstrap
As we know that we can modify a view by using ALTER VIEW statement but other than that we can also use CREATE OR REPLACE VIEW to modify an existing view. The concept is simple as MySQL simply modifies the view if it already exists otherwise a new view would be created. Following is the syntax of it −SyntaxCREATE OR REPLACE VIEW view_name AS Select_statements FROM table;Examplemysql> Create OR Replace VIEW Info AS Select Id, Name, Address, Subject from student_info WHERE Subject = 'Computers'; Query OK, 0 rows affected (0.46 sec)The above query will create or replace a view ‘Info’. ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP