String function ASCII() in MySQL returns the ASCII number code of the specific character. , Here, str, the argument of ASCII() function, is the string whose ASCII value of the first character to be retrieved. It is pertinent to mention here that it will return the number code the left the most character i.e. first character of the string given as argument. ,
INSERT command is used to add values to the columns of a MySQL table. We need to specify the values in INSERT command for all the columns as follows: , Suppose we have a table named ‘Stock’ with three columns ‘Item_id’, ‘Item_name’ and ‘Item_rate’ then with the help of following query we can add values in these columns. ,
It can be done by using ‘COMMENT’ keyword while modifying the column with ALTER TABLE command. For example if we want to add comment in column ‘id’ of table ‘testing’ then following query will do it , With following query it can be checked in the comment field of a column. ,
As the name explains, it is used to remove all the record from the MySQL table. , , The query above deleted all the records from the ‘Student’ table. We can observe as MySQL returns empty set after running the following query: ,
By using MODIFY keyword with ALTER TABLE command we can modify the column/s of MySQL table. The syntax for the same is as follows; , In the example below, with the help of MODIFY keyword in ALTER Command, the size of column ‘Address’ and ‘Grade’ has been modified. ,
MySQL SHOW CREATE TABLE statement will provide us the constraints applied to a particular table along with some other details about that table. Its syntax would be as follows: , Here table_name is the name of the table on which we want to see the constraints. In this example we are getting the detail of the table named ‘employees’: , The above result set shows that there is a PR.....
Multicolumn UNIQUE indexes can also be removed in the same as we remove UNIQUE constraint from the table. In this example, with the following query we have removed the multicolumn UNIQUE indexes on table ‘employee’: , The removal of UNIQUE indexes can be observed from the result sets of the following query: ,
As the name suggests, MySQL UNIQUE constraint maintains the uniqueness of a column in the table and does not allow inserting the duplicate value. Basically, UNIQUE constraint creates an index such that all the values in the index column must be unique. It is pertinent to mention here that we can have more than one UNIQUE column in a MySQL table. We can apply UNIQUE constraint by mentioning .....
Actually, MySQL NOT NULL constraint restricts a column of the table from having a NULL value. Once we applied NOT NULL constraint to a column, then we cannot pass a null value to that column. It cannot be declared on the whole table i.e., in other words, we can say that NOT NULL is a column level constraint. For declaring a field NOT NULL, we have to use NOT NULL keyword while defining the .....
A scope is a region of the program and broadly speaking there are three places, where variables can be declared − Inside a function or a block which is called local variables, In the definition of function parameters which is called formal parameters. Outside of all functions which are called global variables.Local variables can be used only by statements that are insi.....
Sign up now to get your own personalized profile!
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more