The NIST Tests Were Not Standard SQL


By Peter Gulutzan
November 2002
Copyright (c) 2002, by Ocelot Computer Services Inc. All Rights Reserved.

NIST (the National Institute for Standards and Testing) used to put out tests which "verified" whether a DBMS complied with SQL standard requirements. They are obsolete, but some commentators still refer to them today. Some have even suggested that SQL-92 is preferable to the current standard (SQL-99 aka SQL:1999), because SQL-92 conformance can be "verified" by the NIST tests and SQL-99 cannot be. I have written this article to dispute those suggestions. I have tested the NIST tests, and concluded:

Any DBMS which passes the NIST tests is violating the SQL standard.

How I tested

I downloaded the tests from the NIST site (they are publicly available nowadays). I looked only at SQL tests in \nist\schema (which create schemas and tables), and the SQL tests in \nist\sql (which run statements against the schemas and tables). There are many text files in these sections, mostly ending with the extension .SQL. Each file contains one or more tests. Typically a test consists of an SQL statement which a DBMS must execute. For example, file cts5sch2.sql contains a CREATE TABLE statement that looks like this (I have removed columns which are not relevant to the illustration):

CREATE TABLE DATA_TYPE (DEC DECIMAL);

But the statement is illegal! According to the SQL standard, DEC is a reserved word. Therefore a DBMS can pass NIST, or it can conform to the SQL standard. It can't do both. I know that's only one example, but I'll supply many more.

I should make these caveats:

The errors that I found

These are some of the things that I found. This is only a sampling, since NIST usually makes the same sort of error multiple times. I have only included one representative sample for each error. Where I say or imply that a feature is "required by NIST" I mean that the syntax of a NIST test, or a comment that accompanies it, makes it clear that NIST wants a conformant DBMS to accept the statement and/or behave the specified way. I have not troubled to cite the individual .sql file names, but will respond to anyone who cannot find them..

Therefore, any vendor whose DBMS "passed" the NIST tests does not have the right to claim compliance with any version of the SQL standard at any level. It's good that NIST had tests, and it's good to hear that another group is planning tests for SQL:2003 conformance, but there was no golden age when standard-SQL conformance was verifiable by tests. The only certain measure is a comparison of the vendor's actions with the ANSI/ISO 9075 standard documents.

I'll quote Hal Berenson here from an article he posted on microsoft.public.sqlserver.server in October 2002: "Many a vendor who started working on SQL92 before the test suite was final had to do some re-engineering once they discovered how NIST was interpreting the standard." I should note, though, that Mr Berenson used this datum to come to an entirely different conclusion than mine.


Peter Gulutzan co-wrote SQL-99 Complete, Really and several articles in the online magazine dbazine.com, one of which is "SQL Standards" (http://dbazine.com/gulutzan3.html). His most recent book, with Trudy Pelzer, is SQL Performance Tuning which eWEEK and sql-server-performance.com have praised highly.

Copyright (c) 2002 by Ocelot Computer Services Inc. All rights reserved.
Return to Ocelot home page
Send enquiries or suggestions to: help@ocelot.ca