Pete Freitag Pete Freitag


Updated on December 07, 2023
By Pete Freitag

I've known about the INFORMATION_SCHEMA views (or system tables) in SQL Server for a while, but I just leared recently that they are actually part of the SQL-92 standard and supported on other database platforms.

The INFORMATION_SCHEMA views provide meta data information about the tables, columns, and other parts of your database. Because the structure of these tables are standardized you can write SQL statements that work on various database platforms.

For example suppose you want to return a resultset with a list of all columns in a table called employees

SELECT table_name, column_name, is_nullable, data_type, character_maximum_length
WHERE table_name = 'employees'

Quite a handy feature, but it's hard to find what versions the of various database platforms started supporting this feature, here's a quick list:

  • Microsoft SQL Server - Supported in Version 7 and up
  • MySQL - Supported in Version 5 and up
  • PostgreSQL - Supported in Version 7.4 and up
  • Oracle - Does not appear to be supported
  • Apache Derby - NOT Supported As of Version 10.3

I have been using the INFORMATION_SCHEMA views to build some automatic datatype validation. With the INFORMATION_SCHEMA you can get the datatype, max character length, and if null values are allowed, and perform validation before it hits the database. And if a column is made wider, you don't have to make any code changes.

Ofcourse if you are using ColdFusion 8, you can use the new cfdbinfo tag to get the same column information. The cfdbinfo actually uses the JDBC Driver's getMetaData() method (this is part of the JDBC Standard that Drivers implement this method). Apache Derby doesn't support the INFORMATION_SCHEMA views because they prefer to simply implement the JDBC Driver's getMetaData() method.

Here's a list of the information schema views:


sql mysql postgresql sqlserver derby information_schema standards cfdbinfo

INFORMATION_SCHEMA Support in MySQL, PostgreSQL was first published on February 18, 2008.

If you like reading about sql, mysql, postgresql, sqlserver, derby, information_schema, standards, or cfdbinfo then you might also like:

Discuss / Follow me on Twitter ↯



Nice post, keep it up.

Can you please provide the links for your list of Information Schema compatibility.

I found:

MySQL 5.0:

MS SQL 2005

PostgreSQL 8.1

However, I have been unable to locate this information for Oracle, and I was under the impression that Oracle does *not* provide an information_schema (although they do of course offer their own system views - the USER_%, DBA_% and ALL_% views)

kind regards,

Roland Bouman
by Roland Bouman on 02/18/2008 at 8:29:10 AM UTC
This is really nice. I have really liked the INFORMATION_SCHEMA views in SQL Server. It will be nice when those views have more ubiquitous support and it looks like vendors are catching on.
by Steve Bryant on 02/18/2008 at 8:40:14 AM UTC
Hi Roland,

I am trying to find something on Oracle's site, but it appears to be down? I found several web pages that mention 9i supporting it, but I will confirm and update if the information is incorrect.

Any easy way to find out is if anyone reading this has Oracle 9i installed?
by Pete Freitag on 02/18/2008 at 9:31:29 AM UTC
Yes, the INFORMATION_SCHEMA is part of the SQL-92 standard. But unfortunately it's not practical to rely on it as a means of cross-database standardized queries against metadata.

- MySQL's implementation was unusably slow prior to 5.1.23, but they appear to have improved it.

- PostgreSQL's implementation of INFORMATION_SCHEMA is buggy. I have read that most people INFORMATION_SCHEMA and instead use the old PostgreSQL-proprietary system tables.

- Oracle has proprietary catalog tables, and does not support INFORMATION_SCHEMA.

IBM DB2 also uses proprietary catalog tables, and does not support INFORMATION_SCHEMA.

- InterBase/Firebird also uses proprietary catalog tables and does not support INFORMATION_SCHEMA. The InterBase manual shows how to create views against its catalog tables to match the spec for INFORMATION_SCHEMA relations.
by Bill Karwin on 02/18/2008 at 11:11:15 AM UTC
Yes, too bad Firebird doesn't come with those views as standard.
But I have to disagree with Bill aobut PostgreSQL, it's information schema implementation is not buggy, it's just that people go with "true and tested" which means system tables (the same happens with mssql) and would happen with Oracle which right now doesn't support this standard.
by pp on 02/18/2008 at 1:41:48 PM UTC
Actually Oracle has had an information schema since at least version 7. Users are given views of the data in these schemas which depend upon their privileges.

Examples are user_tables for all tables owned by you, all_tables for all tables that you have access to and dba_tables for all tables.

These views are very comprehensive and would allow you to recreate any schema object.
by Paul on 02/18/2008 at 7:56:45 PM UTC
Pete - no.

The point is that Oracle has indeed its own set of system views for metadata. That is nice and all, and the information you get from these is very rich, no complaints there. But it is *not* an implementation of the standard SQL feature called "information_schema" and you cannot simply port queries from one platform to the other.
by Roland Bouman on 02/19/2008 at 1:09:20 AM UTC
Hi There,

thank you all for this fruitful information. I am very new to DB.
I but i was also trying to figure out how to get the schema name, that table belongs to? Because the same table name can be used under different schema's. It would be good if we retrieve the schema name also.

I tried the below query
SELECT schema_name, table_name, column_name, is_nullable, data_type, character_maximum_length
WHERE table_name = 'Sales'

Error: column "schema_name" does not exist

by Deepak Murthy on 09/30/2008 at 2:24:07 PM UTC