Extensions
Running SQL Queries in MySQL
#### The `mysql_query` Table Function {#docs:extensions:mysql::the-mysql_query-table-function}  
The `mysql_query` table function allows you to run arbitrary read queries within an attached database. `mysql_query` takes the name of the attached MySQL database to execute the query in, as well as the SQL query to execute. The result of the query is returned. Single-quote strings are escaped by repeating the single quote twice.  
```sql
mysql_query(attached_database::VARCHAR, query::VARCHAR)
```  
For example:  
```sql
ATTACH 'host=localhost database=mysql' AS mysqldb (TYPE MYSQL);
SELECT * FROM mysql_query('mysqldb', 'SELECT * FROM cars LIMIT 3');
```  
#### The `mysql_execute` Function {#docs:extensions:mysql::the-mysql_execute-function}  
The `mysql_execute` function allows running arbitrary queries within MySQL, including statements that update the schema and content of the database.  
```sql
ATTACH 'host=localhost database=mysql' AS mysqldb (TYPE MYSQL);
CALL mysql_execute('mysqldb', 'CREATE TABLE my_table (i INTEGER)');
```