Found 4381 Articles for MySQL

How can we enter numerical values as a BINARY number in MySQL statement?

vanithasree
Updated on 22-Jun-2020 12:21:32

143 Views

Following are the two approaches with the help of which we can enter numeric values as a BINARY number −By prefix ‘B’In this approach we need to quote binary numbers within single quotes with a prefix of B. Then BINARY number string will be automatically converted into a numerical value based on the expression context.Examplemysql> Select B'1110'+0; +-----------+ | B'1110'+0 | +-----------+ |        14 | +-----------+ 1 row in set (0.00 sec)By prefix 0bIn this approach, we need to write BINARY numbers without any quotes with a prefix of 0b. Then BINARY number string will be automatically ... Read More

How can we enter characters as a BINARY number in MySQL statement?

Smita Kapse
Updated on 22-Jun-2020 12:22:22

207 Views

Following are the two approaches with the help of which we can enter characters as a BINARY number −By prefix ‘B’In this approach we need to quote binary numbers within single quotes with a prefix of B. Then BINARY number string will be automatically converted into a character string.Examplemysql> Select B'01000001'; +-------------+ | B'01000001' | +-------------+ | A           | +-------------+ 1 row in set (0.00 sec)By prefix 0bIn this approach, we need to write BINARY numbers without any quotes with a prefix of 0b. Then BINARY number string will be automatically converted into a character ... Read More

How can we see the information on triggers order in case of multiple triggersfor same event and action time?

karthikeya Boyini
Updated on 22-Jun-2020 12:12:28

90 Views

It can be done with the help of the following query −mysql> SELECT trigger_name,action_order FROM INFORMATION_SCHEMA.triggers WHERE TRIGGER_SCHEMA = 'query' ORDER BY event_object_table,action_timing,event_manipulation; +------------------------------+--------------+ | trigger_name                 | action_order | +------------------------------+--------------+ | studentdetail_before_update  |            1 | | studentdetail_before_update2 |            2 | +------------------------------+--------------+ 2 rows in set (0.10 sec)The above result set shows the order of multiple triggers created on the same event and action time in the database ‘query’.

How is it possible for a MySQL trigger to execute multiple statements?

Venu Madhavi
Updated on 27-Jan-2025 16:33:55

1K+ Views

In MySQL, triggers are a mechanism that allow for specific actions to be executed automatically when specific events like Insert, Update, or Delete occur in a table. They are useful as they automate processes and maintain data integrity. Using BEGIN...END in trigger In a trigger, if we want to perform more than one action we write it within the BEGIN…END block. This block simplifies the way we can manage a larger number of actions for a more complicated task. Let us see how the BEGIN...END construct allows multiple statements to be executed within a trigger. We can group ... Read More

How can we enter numeric values as Hexadecimal (HEX) number in MySQL statement?

radhakrishna
Updated on 22-Jun-2020 12:23:10

221 Views

Following are the two approaches with the help of which we can enter numeric values as a Hexadecimal number −By prefix ‘X’In this approach we need to quote hexadecimal numbers within single quotes with a prefix of X. Then HEX number string will be automatically converted into a number based on the expression context.Examplemysql> Select X'5152545678'+ 10; +-------------------+ | X'5152545678'+ 10 | +-------------------+ | 349273609858      | +-------------------+ 1 row in set (0.00 sec)By prefix 0xIn this approach, we need to write hexadecimal numbers without any quotes with a prefix of 0x. Then HEX number string will be automatically ... Read More

How can we enter characters as Hexadecimal (HEX) number in MySQL statement?

mkotla
Updated on 22-Jun-2020 12:25:02

1K+ Views

Following are the two approaches with the help of which we can enter characters as a Hexadecimal number −By prefix ‘X’In this approach we need to quote hexadecimal numbers within single quotes with a prefix of X. Then HEX number string will be automatically converted into a character string.Examplemysql> Select X'5152545678'; +---------------+ | X'5152545678' | +---------------+ | QRTVx         | +---------------+ 1 row in set (0.00 sec)By prefix 0xIn this approach, we need to write hexadecimal numbers without any quotes with a prefix of 0x. Then HEX number string will be automatically converted into a character string.Examplemysql> ... Read More

How can we escape special characters in MySQL statement?

Nishtha Thakur
Updated on 22-Jun-2020 12:24:08

1K+ Views

Sometimes we need to include special characters in a character string and at that time they must be escaped or protected. We need to pursue some basic rules for escaping special characters which are given below −The escape character (\) can be escaped as (\)Examplemysql> Select 'A\B'; +-----+ | A\B | +-----+ | A\B | +-----+ 1 row in set (0.00 sec)

In which order MySQL will invoke the triggers if we created multiple triggers of same event and action time?

Venu Madhavi
Updated on 04-Feb-2025 16:20:01

437 Views

In MySQL, triggers allow automatic execution of specified actions in response to INSERT, UPDATE or DELETE events on a table. Often, multiple triggers may be created for the same event and action time (e.g.; multiple BEFORE INSERT triggers on the same table). By default, MySQL invokes these triggers in the order they have created. However, the FOLLOWS and PRECEDES option allows control over the sequence of execution which can be critical in complex data handling. In this article, we will explore how to set the order of multiple triggers for the same event and action ... Read More

How can we create multiple MySQL triggers for the same trigger event and action time?

Venu Madhavi
Updated on 22-Jan-2025 17:34:29

819 Views

In MySQL, a trigger is a group of SQL statements performed or fired when a specified event is taken place on tables. The events can include INSERT, UPDATE, and DELETE. Such triggers are used for automating repetitive work, ensuring integrity in data, and keeping audit records without human involvement. The FOLLOWS keyword in MySQL allows the creation of several triggers for the same event and also allows you to select the order of execution. Creating Multiple Triggers for the Same Event When working with triggers, sometimes you might need to define several triggers for the same ... Read More

Why do we need to change the delimiter for creating a trigger?

Swarali Sree
Updated on 22-Jun-2020 12:15:45

586 Views

As we know that in MySQL we use the delimiter semicolon (;) to end each statement. The semicolon is the by default delimiter in MySQL. We need to change the delimiter, while creating a trigger, to tell MySQL that this is not the end of our trigger statement because we can use multiple statements in the trigger. We can change the delimiter temporarily by DELIMITER // statement to change the delimiter from Semicolon (;) to two back-slash (//). After this MySQL would know that the triggering statement only ends when it encounters a two back-slash (//). Following is an example ... Read More

Advertisements