I have an application that uses several different databases to collect similar information. I do this through an ODBC interface, which effectively abstracts my persistence layer from my application layer, and it works fairly well.
Here's the thing: I want to have a bit more specific queries than
SELECT * FROM [TableName]
As far as I can tell, this works for all ODBC databases, but when you start to get a little more specific, syntax and language usage become more problematic. The query that will work in MySQL will not necessarily work in MSSQL; the query that runs fine against Oracle will not fare so well against PostgreSQL.
But ODBC is an abstraction layer, so I'm thinking there must be a language reference that all ODBC-compliant database systems support. If I write my queries using those language constructs, I should expect to get similar results back, regardless of the database system.
Am I right? Is there such a standard? If so, where can I find the language reference so I can write my queries accordingly? Things I'm interested in in particular are constructs like:
- TOP (LIMIT)
- MID (SUBSTR)
- CAST (CONVERT)
etc. Thanks for your help!