Call values Form SQL Database via mqtt

I'm searching for a way to get values from a sql database to the ESP32. There are several tutorials to send vales to sql database but I couldn't find anything how to get it.
I want to get time values from the database via mqtt to trigger certain actions on the esp32.
Would be great if anyone could give me some guidance to solve it.

I think you can set up a serial link with the ESP32, then send the data from the SQL data base to the ESP32. The hardware layer has lots of possibilities. There are a lot of details left for you to work out. I am not versed in SQL so I will not be able to help you but others can. You can find several you tube videos on the ESP32 serial ports, I believe there are three. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!

You need to have an application that creates SQL queries and turns the answers into MQTT messages.

There are MQTT python examples and you can use python for SQL.

I have a Raspberry Pi where I run:

  • mosquitto as MQTT broker
  • node-red as programing environment (graphical UI with nodes, and JavaScript)
  • influxdb is a time series database to store the data, supports SQL style syntax

I can send MQTT messages from an Arduino and store the value in the database
I can create SQL style queries and use the data for display on a website or send MQTT message to my Arduino

To give you some more specific ideas it would be helpful to know, how your system compares to the one I am using. e.g. where is your SQL database, MQTT broker, what programing environment you would like to use for the server side?