Few people know about the INFORMATION_SCHEMA views that have been there since SQL-92.
Two funny things about that standard:
- Until the 1990’s, Digital Equipment Corporation was still heavily involved in SQL.
Back then Jim Melton from Digital Equipment Corporation (now at W3C, before that at Oracle and Sybase), was the editor of the SQL-92 standard.
Another Jim worked at DEC until 1981 with great influences on other relational databases too. - Of the four levels in the SQ-92, no database vendors have been certified higher than the “Entry Level”.
A few reasons I can imagine not many people know about the INFORMATION_SCHEMA:
- Not all relational database servers implement them, and of the ones that do implement them, not all versions implement all views.
That’s what this article is about; currently it lists only SQL Server 2000 and 2008 R2 (tried both) and PostgreSQL (verified docs), but I will update it as soon as I have run the script on other versions of SQL server and database vendors. - It is hard to find the official ISO standards in a public way, and ISO itself sometimes puts things online, and at other times wants money for it
I remember the Y2K preparation era where the ISO-8601 standard was freely available at http://www.iso.ch/markete/8601.pdf, soon after the Year 2000, the PDF got locked behind a payment engine.
ISO suffers from heavy link rot too, for instance the ISO 3166 country codes used to be at http://www.iso.org/iso/prods-services/iso3166ma, but are now at http://www.iso.org/iso/home/standards/country_codes.htm. What about HTTP 303 or 302 redirect here guys?
Since SQL-92, the INFORMATION_SCHEMA (and its twin DEFINITION_SCHEMA) have been extended. The last extension in 2008. Together they allow SQL databases to be self-describing (I think no vendor has attained that) and the structures queryable in a standard way
In fact that is the main purpose: these views in INFORMATION_SCHEMA are a very convenient standard way to query – in a vendor agnostic way – about tables, views, columns, etc. Read the rest of this entry »