How to make sensor that show historical value of sensor

I’m trying to make a sensor that listen to a date ( that created by helper) and pull the value of sensor by the date i was selected,
I have a mariaDB so maybe i can pull it directly from the DB ?

Thank for the help

Yes, an SQL sensor is what you require: