Skip to content

re: Who owns the SQL standard? VIEW POST


According to that standard, how is the datatype for integers called? And how, according to that standard, do you skip and limit query results?

In my SQL, integer datatypes do not exist. There are other types of datatypes like sets. Query result may be limited as required.

Your SQL doesn't have integers. In T-SQL they are called INT. In PostgreSQL you need to write INTEGER. MySQL and SQLite allow both INT and INTEGER, and in Oracle it's actually NUMBER.

Not much of a standard if it can't even dictate something as basic and common and integer data types...

Postgres allows INT shorthand, and Oracle also allows INTEGER/INT specifically to conform with the standard while storing those values as its internal non-standard NUMBER type under the hood (completely allowable). The 2011 Framework spec notes that

Every data type is either predefined, constructed, or user-defined. Every data type has a name. The name of a predefined or constructed data type is a reserved word specified by that part of ISO/IEC 9075 that specifies the data type.

The relevant part of ISO/IEC 9075 does not, unfortunately, appear to be free to download and I don't feel like spending money to prove a point on the internet. However, those types are indeed specified should you care to look them up, and vendors with nonstandard types actually have to include the standard types to conform.

I've long assumed that OFFSET and LIMIT are standard and MS just haven't felt like getting SQL Server's TOP and bizarrely contorted row offsets in line but that's admittedly an educated guess.

T-SQL has INTEGER as well. Same as INT. 🙂

code of conduct - report abuse