### Apache Airflow version

2.4.3

### What happened

Tried executing the following command to clean old data in my service:

```
airflow db clean --skip-archive --clean-before-timestamp '2022-10-31 00:00:00+0000'  --tables 'xcom, log, dag_run, task_instance' --verbose --yes
```
Then got the following error

```
...
[2022-12-02T08:34:18.065+0000] {db_cleanup.py:138} DEBUG - ctas query:
CREATE TABLE _airflow_deleted__dag_run__20221202083418 AS SELECT base.*
FROM dag_run AS base LEFT OUTER JOIN (SELECT dag_id, max(dag_run.start_date) AS max_date_per_group
FROM dag_run
WHERE external_trigger = false GROUP BY dag_id) AS latest ON base.dag_id = latest.dag_id AND base.start_date = max_date_per_group
WHERE base.start_date < :start_date_1 AND max_date_per_group IS NULL
[2022-12-02T08:34:18.069+0000] {cli_action_loggers.py:83} DEBUG - Calling callbacks: []
Traceback (most recent call last):
  File "/opt/app-root/lib64/python3.8/site-packages/mysql/connector/connection_cext.py", line 565, in cmd_query
    self._cmysql.query(
_mysql_connector.MySQLInterfaceError: Statement violates GTID consistency: CREATE TABLE ... SELECT.The above exception was the direct cause of the following exception:Traceback (most recent call last):
  File "/opt/app-root/lib64/python3.8/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
    self.dialect.do_execute(
  File "/opt/app-root/lib64/python3.8/site-packages/sqlalchemy/engine/default.py", line 719, in do_execute
    cursor.execute(statement, parameters)
  File "/opt/app-root/lib64/python3.8/site-packages/mysql/connector/cursor_cext.py", line 279, in execute
    result = self._cnx.cmd_query(
  File "/opt/app-root/lib64/python3.8/site-packages/mysql/connector/connection_cext.py", line 573, in cmd_query
    raise get_mysql_exception(
mysql.connector.errors.DatabaseError: 1786 (HY000): Statement violates GTID consistency: CREATE TABLE ... SELECT.The above exception was the direct cause of the following exception:Traceback (most recent call last):
...
```

our MySQL server has `enforce_gtid_consistency` parameter set to ON and it does not allow `CREATE TABLE ... SELECT`  statement.

### What you think should happen instead

I expected that the command should work for MySQL with enforce_gtid_consistency enabled.

### How to reproduce

As described above.

### Operating System

K8S with base image is CentOS

### Versions of Apache Airflow Providers

_No response_

### Deployment

Official Apache Airflow Helm Chart

### Deployment details

_No response_

### Anything else

Can we avoid this kind of issue by breaking the statement into 2, like:
```
CREATE TABLE _airflow_deleted__dag_run__20221202083418 LIKE dag_run; 
INSERT _airflow_deleted__dag_run__20221202083418 SELECT * FROM  SELECT base.*
FROM dag_run AS base LEFT OUTER JOIN (SELECT dag_id, max(dag_run.start_date) AS max_date_per_group
FROM dag_run
WHERE external_trigger = false GROUP BY dag_id) AS latest ON base.dag_id = latest.dag_id AND base.start_date = max_date_per_group
WHERE base.start_date < :start_date_1 AND max_date_per_group IS NULL;

```
Ref: https://stackoverflow.com/a/56068655/1526790

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

return dict(
            table=self.orm_model.name,
            recency_column=str(self.recency_column),
            keep_last=self.keep_last,
            keep_last_filters=[str(x) for x in self.keep_last_filters] if self.keep_last_filters else None,
            keep_last_group_by=str(self.keep_last_group_by),
        )
config_list: list[_TableConfig] = [
    _TableConfig(table_name="job", recency_column_name="latest_heartbeat"),
    _TableConfig(table_name="dag", recency_column_name="last_parsed_time"),
    _TableConfig(
        table_name="dag_run",
        recency_column_name="start_date",
        extra_columns=["dag_id", "external_trigger"],
        keep_last=True,
        keep_last_filters=[column("external_trigger") == false()],
        keep_last_group_by=["dag_id"],
    ),
    _TableConfig(table_name="dataset_event", recency_column_name="timestamp"),
    _TableConfig(table_name="import_error", recency_column_name="timestamp"),
    _TableConfig(table_name="log", recency_column_name="dttm"),
    _TableConfig(table_name="sla_miss", recency_column_name="timestamp"),
    _TableConfig(table_name="task_fail", recency_column_name="start_date"),
    _TableConfig(table_name="task_instance", recency_column_name="start_date"),
    _TableConfig(table_name="task_reschedule", recency_column_name="start_date"),
    _TableConfig(table_name="xcom", recency_column_name="timestamp"),
    _TableConfig(table_name="callback_request", recency_column_name="created_at"),
    _TableConfig(table_name="celery_taskmeta", recency_column_name="date_done"),
    _TableConfig(table_name="celery_tasksetmeta", recency_column_name="date_done"),
]