Re: Field Types Date and Time
> we collect the date for each event and the time i.e. 18/05/2022 at 09:05:03.10
> The table will contain thousands of records and I will be searching for events that occur on the same date and time Plus or Minus x deciseconds
DATETIME(2) is good for you. Data will be stored as "2022-05-18 09:05:03.10".
Precision can be raised to DATETIME(6) (µsec).
You will be able to get events +/− 0.5 seconds with :
SELECT ALL ...
FROM ...
WHERE event_at
BETWEEN '2022-05-18 09:05:03.10' - INTERVAL 0.5 SECOND
AND '2022-05-18 09:05:03.10' + INTERVAL 0.5 SECOND
MICROSECOND interval can be used too
https://dev.mysql.com/doc/refman/8.0/en/expressions.html#temporal-intervals
Subject
Written By
Posted
Re: Field Types Date and Time
May 27, 2022 05:11PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.