Default Type of Bit Value Assigned to User Variables

Arushi
Updated on 22-Jun-2020 05:39:42

187 Views

By default, the bit values assigned to the user variables are binary strings. It can be illustrated by assigning the bit value to a user variable and then by retrieving them as follows −mysql> SET @abc = 0b1000011; Query OK, 0 rows affected (0.00 sec) mysql> Select @abc; +------+ | @abc | +------+ | C    | +------+ 1 row in set (0.00 sec)The above result set shows that the default type of a bit value assigned to user variables are binary strings.

Display MySQL BIT Values in Printable Form

Anjana
Updated on 22-Jun-2020 05:39:10

98 Views

Actually, Bit values are returned as binary values but we can also display them in the printable form with the help of following −By adding 0We can display Bit values in printable form by adding 0 to them. Following the example from the bit_testing table can be used to understand it −mysql> Select bittest+0 from bit_testing; +-----------+ | bittest+0 | +-----------+ |       170 | |         5 | |         5 | +-----------+ 3 rows in set (0.00 sec)By using conversion function BIN(), OCT(), HEX()We can also display Bit values in ... Read More

Create 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

Create Stored Procedure to Update Values in a MySQL Table

Prabhas
Updated on 22-Jun-2020 05:37:02

9K+ Views

We can create a stored procedure with IN operator to update 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    | +------+---------+------------+------------+ | 101  | YashPal | Amritsar   | History    | | 105  | Gaurav  | Jaipur     | Literature | | 110  | Rahul   | Chandigarh | History    | | 125  | Raman   | Bangalore  | Computers  | +------+---------+------------+------------+ 4 rows ... Read More

Assign Bit Value as Number to User Variable

Chandu yadav
Updated on 22-Jun-2020 05:35:55

413 Views

As we know that the default type of a bit values assigned to user variables is binary strings but we can also assign a bit value to a number by using the following two methods −By using CAST() functionWith the help of CAST(… AS UNSIGNED) the bit value can be assigned a number. The following example will illustrate it −mysql> SET @abc = CAST(0b1000011 AS UNSIGNED); Query OK, 0 rows affected (0.00 sec) mysql> Select @abc; +------+ | @abc | +------+ | 67   | +------+ 1 row in set (0.00 sec)By adding 0(+0)The bit value can be assigned ... Read More

Set Height and Width of an Image Using Percent with CSS

radhakrishna
Updated on 22-Jun-2020 05:35:38

965 Views

To set the height and width of an image using %, you can try to run the following code −ExampleLive Demo                    img {             height: 50%;             width: 50%;          }                     Sized image in %          

Create Stored Procedure to Insert Values in MySQL Table

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

14K+ 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

Local Variables in MySQL Stored Procedure

varun
Updated on 22-Jun-2020 05:33:29

474 Views

Local variables are those variables that are declared within the stored procedure. They are only valid within the BEGIN…END block where they are declared and can have any SQL data type. To demonstrate it, we are creating the following procedure −mysql> DELIMITER // ; mysql> Create Procedure Proc_Localvariables()    -> BEGIN    -> DECLARE X INT DEFAULT 100;    -> DECLARE Y INT;    -> DECLARE Z INT;    -> DECLARE A INT;    -> SET Y = 250;    -> SET Z = 200;    -> SET A = X+Y+Z;    -> SELECT X, Y, Z, A;    -> ... Read More

View Complete Information of Stored Procedures in MySQL Database

Sravani S
Updated on 22-Jun-2020 05:32:26

137 Views

We can use mysql.proc to see the list, along with complete information, of stored procedures in a particular MySQL database by the following query −mysql> Select * from mysql.proc where db = 'query' AND type = 'PROCEDURE' \G *************************** 1. row ***************************                   db: query                 name: allrecords                 type: PROCEDURE        specific_name: allrecords             language: SQL      sql_data_access: CONTAINS_SQL     is_deterministic: NO        security_type: DEFINER   ... Read More

View Source Code of MySQL Stored Procedure

Anvi Jain
Updated on 22-Jun-2020 05:31:49

616 Views

With the help of SHOW CREATE PROCEDURE statement, we can see the source code of a stored procedure. To make it understand we are using the stored procedure named allrecords() in the query as follows −mysql> Show Create Procedure allrecords\G *************************** 1. row *************************** Procedure: allrecords sql_mode:ONLY_FULL_GROUP_BY, STRICT_TRANS_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION Create Procedure: CREATE DEFINERb=`root`@`localhost` PROCEDURE `allrecords`() BEGIN Select * from Student_info; END character_set_client: cp850 collation_connection: cp850_general_ci   Database Collation: latin1_swedish_ci 1 row in set (0.00 sec)Read More

Advertisements