You can certainly attach to an Excel spreadsheet and use it as a database, with
SQL.
However, it sounds as though you're talking about using SQL on a workbook from
within the same workbook. Although I've never tried it, I would imagine that it
would be most unlikely to work.
At best, I'd expect the SQL statements to refer to the copy of the workbook that
is on disk, not the one you have open. At worst, I'd expect file access
conflict or straight Excel crashes.
By all means give it a go. A quick Google search will lead you to the connect
strings needed to open an Excel sheet as an ODBC database.