“Dynamic” means that the SQL statement that you execute is constructed, parsed, and compiled at runtime, not at the time the code is compiled. Dynamic SQL offers a tremendous amount of flexibility—but also complexity and more than a little risk.
In the MySQL stored program language, you can process dynamic
SQL by using the MySQL prepared statement feature. You can
create a prepared statement with the
PREPARE statement, supplying the SQL text in
a session variable. The SQL can then be executed with the