Found 4219 Articles for MySQLi

How can I create a stored procedure to delete values from a MySQL table?

Govinda Sai
Updated on 22-Jun-2020 05:38:01

3K+ Views

We can create a stored procedure with IN operator to delete values from a MySQL table. To make it understand we are taking an example of a table named ‘student_info’ having the following data −mysql> Select * from student_info; +------+---------+------------+------------+ | id   | Name    | Address    | Subject    | +------+---------+------------+------------+ | 100  | Aarav   | Delhi      | Computers  | | 101  | YashPal | Amritsar   | History    | | 105  | Gaurav  | Jaipur     | Literature | | 110  | Rahul   | Chandigarh | History    | +------+---------+------------+------------+ ... Read More

What is the method with the help of which the hexadecimal value can be treated as a number?

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

49 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)

What is the default type of a hexadecimal value in MySQL?

Jai Janardhan
Updated on 11-Feb-2020 10:35:43

150 Views

As we know that in numeric contexts the hexadecimal values act like integers and in string contexts they act like binary string. It can be understood with the help of the following example,mysql> Select X'5455544F5249414C53504F494E54'; +---------------------------------+ | X'5455544F5249414C53504F494E54' | +---------------------------------+ | TUTORIALSPOINT                  | +---------------------------------+ 1 row in set (0.07 sec)But, if we are talking about default type of hexadecimal value in MySQL, then it is a string.

How can I create a stored procedure to insert values in a MySQL table?

Krantik Chavan
Updated on 22-Jun-2020 05:34:45

13K+ Views

We can create a stored procedure with an IN operator to insert values in a MySQL table. To make it understand we are taking an example of a table named ‘student_info’ having the following data −mysql> Select * from student_info; +------+---------+-----------+------------+ | id   | Name    | Address   | Subject    | +------+---------+-----------+------------+ | 100  | Aarav   | Delhi     | Computers  | | 101  | YashPal | Amritsar  | History    | | 105  | Gaurav  | Jaipur    | Literature | | 110  | Rahul  | Chandigarh | History    | +------+---------+------------+------------+ 4 rows ... Read More

How can I create a stored procedure to select values on the basis of some conditions from a MySQL table?

seetha
Updated on 22-Jun-2020 05:42:36

279 Views

We can create a stored procedure with IN and OUT operators to SELECT records, based on some conditions, from MySQL table. To make it understand we are taking an example of a table named ‘student_info’ having the following data −mysql> Select * from student_info; +------+---------+------------+------------+ | id   | Name    | Address    | Subject    | +------+---------+------------+------------+ | 101  | YashPal | Amritsar   | History    | | 105  | Gaurav  | Jaipur     | Literature | | 110  | Rahul   | Chandigarh | History    | | 125  | Raman   | Bangalore  | ... Read More

How can I 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

How can I create MySQL stored procedure with OUT parameter?

vanithasree
Updated on 22-Jun-2020 05:43:29

4K+ 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 ... Read More

How can we find the most recent and most oldest date from a table with the help of MySQL MAX() and MIN() functions?

Ankith Reddy
Updated on 22-Jun-2020 05:27:53

6K+ Views

For getting the most recent date from a table, we need to provide the name of the column, having a date as value, as the argument of MAX() function. Similarly, forgetting the oldest date from a table, we need to provide the name of a column, having a date as value, as the argument of MIN() function. To understand it, consider the following example of table ‘Collegedetail’, having the following details −mysql> Select * from collegedetail; +------+---------+------------+ | ID   | Country | estb       | +------+---------+------------+ | 111  | INDIA   | 2010-05-01 | | 130  | ... Read More

How MySQL evaluates when I use a conditional expression within SUM() function?

Samual Sam
Updated on 22-Jun-2020 05:30:20

83 Views

As we know that, by using a conditional expression within SUM() function we can get the number of rows that meet the condition. So, in this case, MySQL evaluates to 1 each time the condition is true and 0 each time it is false.To understand it, consider the following example of table ‘employee’, having the following details −mysql> Select * from Employee; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 2  | Rahul  | 20000  | | 3  | Advik  | 25000  | | 4  | Aarav  | 65000  | ... Read More

How can I create MySQL stored procedure with IN parameter?

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

339 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

Advertisements