Derby support for SQL-92 features

There are four levels of SQL-92 support:
  • SQL92E

    Entry

  • SQL92T

    Transitional, a level defined by NIST in a publication called FIPS 127-2

  • SQL92I

    Intermediate

  • SQL92F

    Full

Basic data types

The following table shows Derby support for the SQL-92 basic data types.
Table 1. Support for SQL-92 Features: Basic data types
Feature Source Derby
SMALLINT SQL92E Yes
INTEGER SQL92E Yes
DECIMAL(p,s) SQL92E Yes
NUMERIC(p,s) SQL92E Yes
REAL SQL92E Yes
FLOAT(p) SQL92E Yes
DOUBLE PRECISION SQL92E Yes
CHAR(n) SQL92E Yes

Basic math operations

Table 1. Support for SQL-92 Features: Basic math operations
Feature Source Derby
+, *, -, /, unary +, unary - SQL92E Yes

Basic comparisons

Table 1. Support for SQL-92 Features: Basic comparisons
Feature Source Derby
<, >, <= ,>=, <>, = SQL92E Yes

Basic predicates

Table 1. Support for SQL-92 Features: Basic predicates
Feature Source Derby
BETWEEN, LIKE, NULL SQL92E Yes

Quantified predicates

Table 1. Support for SQL-92 Features: Quantified predicates
Feature Source Derby
IN, ALL/SOME, EXISTS SQL92E Yes

Schema definition

Table 1. Support for SQL-92 Features: schema definition
Feature Source Derby
Tables SQL92E Yes
Views SQL92E Yes
Privileges SQL92E Yes

Column attributes

Table 1. Support for SQL-92 Features: column attributes
Feature Source Derby
Default values SQL92E Yes
Nullability SQL92E Yes

Constraints (non-deferrable)

Table 1. Support for SQL-92 Features: constraints (non-deferrable)
Feature Source Derby
NOT NULL SQL92E Yes (not stored in SYSCONSTRAINTS)
UNIQUE/PRIMARY KEY SQL92E Yes
FOREIGN KEY SQL92E Yes
CHECK SQL92E Yes
View WITH CHECK OPTION SQL92E No, views cannot be updated

Cursors

Table 1. Support for SQL-92 Features: Cursors
Feature Source Derby
DECLARE, OPEN, FETCH, CLOSE SQL92E Yes, by using JDBC method calls
UPDATE, DELETE CURRENT SQL92E Yes

Dynamic SQL 1

Table 1. Support for SQL-92 Features: Dynamic SQL 1
Feature Source Derby
ALLOCATE / DEALLOCATE / GET / SET DESCRIPTOR SQL92T Yes, by using JDBC method calls
PREPARE / EXECUTE / EXECUTE IMMEDIATE SQL92T Yes, by using JDBC method calls
DECLARE, OPEN, FETCH, CLOSE, UPDATE, DELETE dynamic cursor SQL92T Yes, by using JDBC method calls
DESCRIBE output SQL92T Yes, by using JDBC method calls

Basic information schema

Table 1. Support for SQL-92 Features: Basic information schema
Feature Source Derby
TABLES SQL92T SYS.SYSTABLES, SYS.SYSVIEWS, SYS.SYSCOLUMNS
VIEWS SQL92T SYS.SYSTABLES, SYS.SYSVIEWS, SYS.SYSCOLUMNS
COLUMNS SQL92T SYS.SYSTABLES, SYS.SYSVIEWS, SYS.SYSCOLUMNS

Basic schema manipulation

Table 1. Support for SQL-92 Features: Basic schema manipulation
Feature Source Derby
CREATE / DROP TABLE SQL92T Yes
CREATE / DROP VIEW SQL92T Yes
GRANT / REVOKE SQL92T Yes
ALTER TABLE ADD COLUMN SQL92T Yes
ALTER TABLE DROP COLUMN SQL92T Yes

Joined table

Table 1. Support for SQL-92 Features: Joined table
Feature Source Derby
INNER JOIN SQL92T Yes
natural join SQL92T No
LEFT, RIGHT OUTER JOIN SQL92T Yes
join condition SQL92T Yes
named columns join SQL92T Yes

Date and time data types

Table 1. Support for SQL-92 Features: Date and time data types
Feature Source Derby
simple DATE, TIME, TIMESTAMP, INTERVAL SQL92T Yes, not INTERVAL
datetime constants SQL92T Yes
datetime math SQL92T Yes, with Java methods
datetime comparisons SQL92T Yes
predicates: OVERLAPS SQL92T Yes, with Java methods

VARCHAR data type

Table 1. Support for SQL-92 Features: VARCHAR
Feature Source Derby
LENGTH SQL92T Yes
concatenation (||) SQL92T Yes

Transaction isolation

Table 1. Support for SQL-92 Features: Transaction isolation
Feature Source Derby
READ WRITE / READ ONLY SQL92T By using JDBC, database properties, and storage media
RU, RC, RR, SER SQL92T Yes

Multiple schemas per user

Table 1. Support for SQL-92 Features: Multiple schemas per user
Feature Source Derby
SCHEMATA view SQL92T SYS.SYSSCHEMAS

Privilege tables

Table 1. Support for SQL-92 Features: Privilege tables
Feature Source Derby
TABLE_PRIVILEGES SQL92T No
COLUMNS_PRIVILEGES SQL92T No
USAGE_PRIVILEGES SQL92T No

Table operations

Table 1. Support for SQL-92 Features: Table operations
Feature Source Derby
UNION relaxations SQL92I Yes
EXCEPT SQL92I Yes
INTERSECT SQL92I Yes
CORRESPONDING SQL92I No

Schema definition statement

Table 1. Support for SQL-92 Features: Schema definition statement
Feature Source Derby
CREATE SCHEMA SQL92I Partial support

User authorization

Table 1. Support for SQL-92 Features: User authorization
Feature Source Derby
SET SESSION AUTHORIZATION SQL92I Use SET SCHEMA
CURRENT_USER SQL92I Yes
SESSION_USER SQL92I Yes
SYSTEM_USER SQL92I No

Constraint tables

Table 1. Support for SQL-92 Features: Constraint tables
Feature Source Derby
TABLE CONSTRAINTS SQL92I SYS.SYSCONSTRAINTS
REFERENTIAL CONSTRAINTS SQL92I SYS.SYSFOREIGNKEYS
CHECK CONSTRAINTS SQL92I SYS.SYSCHECKS

Documentation schema

Table 1. Support for SQL-92 Features: Documentation schema
Feature Source Derby
SQL_FEATURES SQL92I/FIPS 127-2 Use JDBC DatabaseMetaData
SQL_SIZING SQL92I/FIPS 127-2 Use JDBC DatabaseMetaData

Full DATETIME

Table 1. Support for SQL-92 Features: Full DATETIME
Feature Source Derby
precision for TIME and TIMESTAMP SQL92F Yes

Full character functions

Table 1. Support for SQL-92 Features: Full character functions
Feature Source Derby
POSITION expression SQL92F Use Java methods or LOCATE
UPPER/LOWER functions SQL92F Yes

Miscellaneous features

Table 1. Support for SQL-92 Features: Miscellaneous
Feature Source Derby
Delimited identifiers SQL92E Yes
Correlated subqueries SQL92E Yes
Insert, Update, Delete statements SQL92E Yes
Joins SQL92E Yes
Where qualifications SQL92E Yes
Group by SQL92E Yes
Having SQL92E Yes
Aggregate functions SQL92E Yes
Order by SQL92E Yes
Select expressions SQL92E Yes
Select * SQL92E Yes
SQLCODE SQL92E No, deprecated in SQL-92
SQLSTATE SQL92E Yes
UNION, INTERSECT, and EXCEPT in views SQL92T Yes
Implicit numeric casting SQL92T Yes
Implicit character casting SQL92T Yes
Get diagnostics SQL92T Use JDBC SQLExceptions
Grouped operations SQL92T Yes
Qualified * in select list SQL92T Yes
Lowercase identifiers SQL92T Yes
nullable PRIMARY KEYs SQL92T No
Multiple module support SQL92T No (not required and not part of JDBC)
Referential delete actions SQL92T CASCADE, SET NULL, RESTRICT, and NO ACTION
CAST functions SQL92T Yes
INSERT expressions SQL92T Yes
Explicit defaults SQL92T Yes
Keyword relaxations SQL92T Yes
Domain definition SQL92I No
CASE expression SQL92I Partial support
Compound character string constants SQL92I Use concatenation
LIKE enhancements SQL92I Yes
UNIQUE predicate SQL92I No
Usage tables SQL92I SYS.SYSDEPENDS
Intermediate information schema SQL92I Use JDBC DatabaseMetaData and Derby system tables
Subprogram support SQL92I Not relevant to JDBC, which is much richer
Intermediate SQL Flagging SQL92I No
Schema manipulation SQL92I Yes
Long identifiers SQL92I Yes
Full outer join SQL92I No
Time zone specification SQL92I No
Scrolled cursors SQL92I Partial support (scrollable insensitive result sets through JDBC 2.0)
Intermediate set function support SQL92I Partial support
Character set definition SQL92I Support for Java locales
Named character sets SQL92I Support for Java locales
Scalar subquery values SQL92I Yes
Expanded null predicate SQL92I Yes
Constraint management SQL92I Yes (ADD/DROP CONSTRAINT)
FOR BIT DATA types SQL92F Yes
Assertion constraints SQL92F No
Temporary tables SQL92F Partial support, with DECLARE GLOBAL TEMPORARY TABLE
Full dynamic SQL SQL92F No
Full value expressions SQL92F Yes
Truth value tests SQL92F Yes
Derived tables in FROM SQL92F Yes
Trailing underscore SQL92F Yes
Indicator data types SQL92F Not relevant to JDBC
Referential name order SQL92F No
Full SQL Flagging SQL92F No
Row and table constructors SQL92F Yes
Catalog name qualifiers SQL92F No
Simple tables SQL92F No
Subqueries in CHECK SQL92F No, but can with Java methods
Union join SQL92F No
Collation and translation SQL92F Java locales supported
Referential update actions SQL92F RESTRICT and NO ACTION. Can do others with triggers.
ALTER domain SQL92F nNo
INSERT column privileges SQL92F No
Referential MATCH types SQL92F No
View CHECK enhancements SQL92F No, views cannot be updated
Session management SQL92F Use JDBC
Connection management SQL92F Use JDBC
Self-referencing operations SQL92F Yes
Insensitive cursors SQL92F Yes through JDBC 2.0
Full set function SQL92F Partial support
Catalog flagging SQL92F No
Local table references SQL92F No
Full cursor update SQL92F No