You could put a PHP script on your server that parses the SQL syntax. A very simple example would be
<?php
include 'connect_to_database.php';
$sql = $_GET['s'];
$result = mysql_qery($sql);
if (!result) echo mysql_error();
else echo $result;
include 'close_database.php';
?>
where the includes contain your database credentials.
Now you can use AppleScript. Suppose that the URL of your PHP file is http://www.exampledomain123.com/file.php then you can use this AppleScript:
sql = urlEncode("SELECT * FROM db_name;")
set shellScript to "curl \"http://www.exampledomain123.com/file.php?s=" & sql & "\""
do shell script shellScript
This should execute the required SQL syntax. It is recommendable to adjust this code by obfuscating the SQL syntax with an additional AppleScript routine and decode the obfuscated string in PHP.
You can find urlEncode routine for AppleScript at http://harvey.nu/applescript_url_encode_routine.html