Is a MySQL statement from an external script possible? I'm working with a PM on a Drupal project, and we're having little success finding a developer to answer (what we believe to be) a simple question.  I'm afraid I have no Drupal experience to speak of.

We've made well aware that Drupal itself doesn't use MySQL statements per se, but it is MySQL based, so - is it possible to write a SQL statement to find all users that have purchased a particular product/sku?  The SQL is to be used in an external script, outside of the website itself.

The developer is vague, at best, so I can't be any more specific than the fact that it's Drupal 7 using a standard ecommerce package.  I absolutely hate asking a broad question like this, but we're locked into this particular resource, and is insisting it will take 100+ hours to get this data to us, and I am unable to get to the DB to even try to construct the SQL.

Any advice is appreciated!  (and if you want some contract work, I'd be MORE than happy to talk).

Clarification

Again, I know this is vague, and the SQL itself would be a bonus in the answer.  The challenge is that the developer insists that Drupal doesn't use SQL statements, and therefore an external script isn't possible because it will take 100 hours to write a Drupal module to get that the result of the query.  I'm imagining something like this to determine if/when a customer last ordered product #1234.:

SELECT MAX(o.orderdate) 
FROM users AS u
JOIN orders AS o on o.userid = u.userid
JOIN orderitems AS i on i.orderid = o.orderid
JOIN products AS p on o.productid = i.productid
WHERE u.email = 'somecustomer@example.com' AND o.productid=1234


With my limited Drupal experience, I know that this example isn't close to correct, but in principal, this is what we need to execute on a different server, with different software to simply get a date or a null.  If she'd give us credentials to look at the database, I could probably figure it out, but her "position" in the matter is that it can only be done with this exhaustive module development effort that she seems to want to do.
Drupal does use SQL statements to communicate with the database, however it does so through a built in abstraction layer. That said, you can write regular old SQL from any PHP script to query the information you need, as long as you have the database connection info. Personally I would build whatever functionality you're after into a custom Drupal module, and then use that to interface with whichever external service you're working with. We would need a bit more information on exactly what you're trying to achieve to provide more specific feedback however.