Treat Hexadecimal Value as a Number

Sai Nath
Updated on 22-Jun-2020 05:26:48

119 Views

For treating the hexadecimal value as a number, we can use the CAST(… AS UNSIGNED) function. Following example will demonstrate it −mysql> Select 0x54, CAST(0x54 AS UNSIGNED); +------+------------------------+ | 0x54 | CAST(0x54 AS UNSIGNED) | +------+------------------------+ | T    |                     84 | +------+------------------------+ 1 row in set (0.01 sec)

Create MySQL Stored Procedure with IN Parameter

Smita Kapse
Updated on 22-Jun-2020 05:26:03

474 Views

To make it understand we are using the table named ‘student_info’ which have the following values −mysql> Select * from student_info; +-----+---------+------------+------------+ | id  | Name    | Address    | Subject    | +-----+---------+------------+------------+ | 101 | YashPal | Amritsar   | History    | | 105 | Gaurav  | Jaipur     | Literature | | 110 | Rahul   | Chandigarh | History    | | 125 | Raman   | Shimla     | Computers  | +------+--------+------------+------------+ 4 rows in set (0.00 sec)Now, with the help of the following query, we will create a stored procedure ... Read More

Create MySQL Stored Procedure with INOUT Parameter

Nishtha Thakur
Updated on 22-Jun-2020 05:25:09

1K+ Views

Following example will demonstrate MySQL stored procedure with INOUT parameter −mysql> DELIMITER // ; mysql> Create PROCEDURE counter(INOUT count INT, IN increment INT)     -> BEGIN     -> SET count = count + increment;     -> END // Query OK, 0 rows affected (0.03 sec)Here, ‘count’ is the INOUT parameter, which can store and return values and ‘increment’ is the IN parameter, which accepts the values from user.mysql> DELIMITER ; mysql> SET @counter = 0; Query OK, 0 rows affected (0.00 sec) mysql> CALL counter(@Counter, 1); Query OK, 0 rows affected (0.00 sec) mysql> Select @Counter; ... Read More

Role of Margin Property with Value Inherit Using CSS

Giri Raju
Updated on 22-Jun-2020 05:24:06

456 Views

The margin property with value inherit is used to inherit an element from the parent element. You can try to run the following code to implement margin: inherit;ExampleLive Demo                    div {             border: 2px solid blue;             margin-left: 50px;          }          p.ex1 {             margin-left: inherit;          }                     Inheriting left margin from the parent element                This is demo text with inherited left margin.           Output

List of Stored Procedures and Functions in MySQL Database

Sreemaha
Updated on 22-Jun-2020 05:22:34

296 Views

We can see the list of the stored procedure and stored functions in a particular database by using the following query on INFORMATION_SCHEMA.ROUTINES as follows −mysql> SELECT ROUTINE_TYPE, ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'query'; +--------------+--------------+ | ROUTINE_TYPE | ROUTINE_NAME | +--------------+--------------+ | PROCEDURE    | allrecords   | | FUNCTION     | Hello        | +--------------+--------------+ 2 rows in set (0.04 sec)The above query returns the procedure named ‘allrecords’, and function named ‘Hello’ which are stored in the database named ‘query’.

Get Starting Number of Characters from MySQL Table Column

Moumita
Updated on 22-Jun-2020 05:22:02

156 Views

To get some starting number of characters from the data stored in the MySQL table’s column, we can use MySQL LEFT() function. It will return the number of characters specified as its argument. We need to provide the name of the column, having the particular record from which we want to get starting characters, as its first argument. To demonstrate it we are taking the example of a table named ‘examination_btech’ having the following examination details of students −mysql> Select * from examination_btech; +-----------+----------+--------+ | RollNo    | Name     | Course | +-----------+----------+--------+ | 201712001 | Rahul   ... Read More

List Stored Procedures in a MySQL Database

Giri Raju
Updated on 22-Jun-2020 05:21:03

211 Views

We can see only the list of stored procedures in a particular MySQL database by the following query −mysql> SELECT ROUTINE_TYPE, ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = 'query'AND ROUTINE_TYPE = 'PROCEDURE'// +--------------+------------------------+ | ROUTINE_TYPE | ROUTINE_NAME           | +--------------+------------------------+ | PROCEDURE    | allrecords             | +--------------+------------------------+ 1 row in set (0.05 sec)

Customize MySQL SUM Function Output to 0 Instead of NULL

Arjun Thakur
Updated on 22-Jun-2020 05:20:30

341 Views

As we know that the SUM() function returns NULL if there is no matching row but sometimes we want it to return zero instead of NULL. For this purpose, we can use the MySQL COALESCE() function which accepts two arguments and returns the second argument if the first argument is NULL, otherwise, it returns the first argument. To understand the above concept, consider an ‘employee_tbl’ table, which is having the following records −mysql> SELECT * FROM employee_tbl; +------+------+------------+--------------------+ | id   | name | work_date  | daily_typing_pages | +------+------+------------+--------------------+ | 1    | John | 2007-01-24 |       ... Read More

Advantages and Disadvantages of Using MySQL Stored Procedures

Nitya Raut
Updated on 22-Jun-2020 05:19:43

3K+ Views

There are numerous advantages and disadvantages of using MySQL stored procedures which are as follows −MySQL Stored Procedure AdvantagesFollowings are the advantages of using MySQL Stored Procedures −Increasing the performance of applications − As we know that after creating the stored procedure it is compiled and stored in the database. But MySQL implements stored procedures slightly different which helps in increasing the performance of the applications. MySQL stored procedures are compiled on demand. After compiling a stored procedure, MySQL puts it into a cache. And MySQL maintains its own stored procedure cache for every single connection. If an application uses ... Read More

View Names and Types of Stored Routines in MySQL Database

V Jyothi
Updated on 22-Jun-2020 05:16:12

168 Views

We can write the following query to see only the name and types of procedures in a particular MySQL database. To make it understand we are using the database named ‘query’ −mysql> Select Name, Type from mysql.proc where db = 'query'; +------------+-----------+ | Name       | Type      | +------------+-----------+ | allrecords | PROCEDURE | | Hello      | FUNCTION  | +------------+-----------+ 2 rows in set (0.18 sec)

Advertisements