![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 4219 Articles for MySQLi
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
801 Views
To understand this concept, we are using the data from table ‘Information’ as follows −mysql> Select * from Information; +----+---------+ | id | Name | +----+---------+ | 1 | Gaurav | | 2 | Ram | | 3 | Rahul | | 4 | Aarav | | 5 | Aryan | | 6 | Krishan | +----+---------+ 6 rows in set (0.00 sec)Now, the query below will fetch the alternate odd-numbered records from the above table ‘Information’ −mysql> Select id,Name from information group by id having mod(id,2) = 1; +----+--------+ | id | Name | +----+--------+ | 1 | Gaurav | | 3 | Rahul | | 5 | Aryan | +----+--------+ 3 rows in set (0.09 sec)
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
2K+ Views
As we know that an event is automatically dropped when it is expired and we would not be able to see it from SHOW EVENTS statement. To change such kind of behavior we can use ON COMPLETION PRESERVE while creating the event. It can be understood from the following example −Examplemysql> Create table event_messages(ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, MESSAGE VARCHAR(255) NOT NULL, Generated_at DATETIME NOT NULL); Query OK, 0 rows affected (0.61 sec)The below query will create an event without the use of ON COMPLETION PRESERVE hence it would not be seen in the output of SHOW EVENTS ... Read More
![Arushi](https://www.tutorialspoint.com/assets/profiles/13510/profile/60_55588-1512537391.jpg)
260 Views
As we know that recurring event means that it will be executed after regular time of interval and expires at the specified time. To illustrate the creation of such kind of events we are using the following example in which we are creating an event which will execute after every minute and expires after one hour −mysql> CREATE EVENT testing_event10 ON SCHEDULE EVERY 1 MINUTE STARTS CURRENT_TIMESTAMP ENDS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT INTO event_message(message, generated_at) Values('Recrring evnts', NOW()); Query OK, 0 rows affected (0.00 sec) mysql> Select * from event_message; +----+----------------+---------------------+ | ID | MESSAGE ... Read More
![Akshaya Akki](https://www.tutorialspoint.com/assets/profiles/13526/profile/60_48621-1512703980.jpg)
197 Views
As we know a one-time event means the events that will be executed only once on a particular schedule. To illustrate the creation of such kind of events we are using the following example in which we are creating an event which will execute after some specified time interval −Examplemysql> CREATE EVENT testing_event5 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE ON COMPLETION PRESERVE DO INSERT INTO event_message(message, generated_at) Values('Hi', NOW()); Query OK, 0 rows affected (0.06 sec) mysql> Select * from event_message; +----+---------+---------------------+ | ID | MESSAGE | Generated_at | +----+---------+---------------------+ | 1 | Hello ... Read More
![Sravani S](https://www.tutorialspoint.com/assets/profiles/13538/profile/60_67753-1512711355.jpg)
241 Views
To understand this concept we are using the data from table ‘Information’ as follows −mysql> Select * from Information; +----+---------+ | id | Name | +----+---------+ | 1 | Gaurav | | 2 | Ram | | 3 | Rahul | | 4 | Aarav | | 5 | Aryan | | 6 | Krishan | +----+---------+ 6 rows in set (0.00 sec)Now, the query below will fetch the alternate even-numbered records from the above table ‘Information’ −mysql> Select id,Name from information group by id having mod(id,2) = 0; +----+---------+ | id | Name | +----+---------+ | 2 | Ram | | 4 | Aarav | | 6 | Krishan | +----+---------+ 3 rows in set (0.00 sec)
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
88 Views
For combining the values of two or more columns of MySQL table, we can use CONCAT() string function. Basically, MySQL CONCAT() function is used to combine two or more strings.SyntaxCONCAT(String1, String2, …, StringN)Here, the arguments of CONCAT functions are the strings that need to be combined.Examplemysql> select CONCAT('Ram', 'is', 'a', 'good', 'boy') AS Remarks; +---------------+ | Remarks | +---------------+ | Ramisagoodboy | +---------------+ 1 row in set (0.00 sec)Similarly, we can use CONCAT() function to combine the values of two or more columns. For example, suppose we have a table named ‘Student’ and we want the name ... Read More
![V Jyothi](https://www.tutorialspoint.com/assets/profiles/13530/profile/60_77592-1512648869.jpg)
649 Views
With the help of an RLIKE operator, we can perform such kind of matching. The only concept is about to use a number of backslashes in MySQL query. The example below will make it clearer −We have the following table having values such as ‘a\b’ and ‘a\b’.mysql> select * from backslashes; +------+-------+ | Id | Value | +------+-------+ | 1 | 200 | | 2 | 300 | | 4 | a\b | | 3 | a\b | +------+-------+ 4 rows in set (0.10 sec)Now suppose if we want to match the ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
72 Views
With the help of RAND() function used along with the ORDER BY clause, the set of rows or values can be randomized in the result set. To understand it considers a table ‘Employee’ having the following records −mysql> Select * from employee; +----+--------+--------+ | ID | Name | Salary | +----+--------+--------+ | 1 | Gaurav | 50000 | | 2 | Rahul | 20000 | | 3 | Advik | 25000 | | 4 | Aarav | 65000 | | 5 | Ram | 20000 | | 6 | Mohan | 30000 | | 7 | Aryan | ... Read More
![Vikyath Ram](https://www.tutorialspoint.com/assets/profiles/13780/profile/60_74413-1512648006.jpg)
667 Views
Actually, MySQL event scheduler is a process that runs in the background and constantly looks for the events to execute. But before we create or schedule an event we just have to start the scheduler. It can start with the help of the following statement −mysql> SET GLOBAL event_scheduler = ON; Query OK, 0 rows affected (0.07 sec)Now with the help of the following statement, we can check its status in MySQL process list −mysql> SHOW PROCESSLIST\G *************************** 1. row *************************** Id: 3 User: root Host: localhost:49500 db: query Command: Query Time: 0 State: ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
78 Views
Basically, there are two kinds of events for which we need to specify the schedule −One-time eventOne-time event means it will be executed only once on a particular schedule. If we want to create a one-time event then we need to put the following syntax after ON SCHEDULE clause −AT Timestamp[+INTERVAL]Recurring eventsRecurring event means that it will be executed after regular time of interval. If we want to create a recurring event then we need to put the following syntax after ON SCHEDULE clause −EVERY interval STARTS timestamp [+INTERVAL] ENDS timestamp [+INTERVAL]