To select data by an interval of 30 minutes in MySQL, you can make use of the
INTERVAL keyword along with the
MINUTE function. Here is an example query:
1 2 3
SELECT * FROM your_table WHERE MINUTE(your_datetime_column) % 30 = 0;
In this query, replace
your_table with the name of your table, and
your_datetime_column with the name of the column containing the datetime values.
MINUTE function extracts the minute value from the datetime column, and the
% operator is used to find the remainder of the division of that minute value by 30. If the remainder is 0, it means the minute is in an interval of 30 minutes.