Subject | SQL comparison |
---|---|
Author | ivoras |
Post date | 2005-10-05T21:15:53Z |
I'm writing an addenum for http://troels.arvin.dk/db/rdbms/ for
FireBird 1.5, and I'd like to check with more experienced users if I
missed something:
(You'll have to read it in parallel with the above web page)
## Legend, definitions, and notes
Firebird:
Firebird version 1.5.2 on FreeBSD; The core features are a superset
of Borland Interbase 6.0, with many bug fixes and SQL compliance
enhancements.
## Features - Views:
Conforms to at least SQL-92.
## Join types and features:
Natural joins: NO
USING-clause: NO
FULL joins: YES
Explicit CROSS JOIN: NO
## The SELECT statement
### Ordering result sets:
Allows ORDER BY in contexts other than cursor definitions.
NULLs are considered lower than any non-NULL value.
### Limiting result sets:
Doesn't support ROW_NUMBER(), supports cursors in all contexts.
Alternative to ROW_NUMBER():
SELECT FIRST x columns
FROM tablename
ORDER BY key ASC
### Top-n query:
Supports the slow standard SQL query variant only.
### Limit-with-offset
Doesn't support ROW_NUMBER(), provides alternative syntax:
SELECT FIRST x SKIP y columns
FROM tablename
ORDER BY key ASC
## The INSERT statement
### Inserting several rows at a time: NO
## Data types
### The BOOLEAN type
Doesn't support BOOLEAN type, possible alternative CHAR(1) with
constraints.
### The CHAR type
Follows the standard.
### The TIMESTAMP type
Follows the standard, but doesn't implement WITH TIMEZONE.
Standard sanity checks pass.
## SQL Functions
### CHARACTER_LENGTH
Firebird is extremely poor on built-in SQL functions (this situation
is remedied in latest 2.0-alpha). CHARACTER_LENGTH() function doesn't
exist and there's no similar functionality.
### SUBSTRING
Only ordinary SUBSTRING variant exists.
### REPLACE
No such functionality exists.
### TRIM
No such functionality exists.
### LOCALTIMESTAMP
No such functionality exists.
### Concatenation
Automatically casts the concatenated values into types compatible
with concatenation. If an operand is NULL then the result is NULL.
## Constraint handling
### UNIQUE constraint
Follows the standard, including the optional NULLs allowed feature.
## Mixture of type and operators
### Automatic key generation
Doesn't support standard IDENTITY attribute, but allows simulation of
BY DEFAULT or even ALWAYS behaviour with triggers and Generators:
CREATE GENERATOR EMPNO_GEN;
CREATE TRIGGER CREATE_EMPNO FOR EMPLOYEES
BEFORE INSERT
AS BEGIN
NEW.EMPNO = GEN_ID (EMPNO_GEN, 1);
END;
## Command-line procedures
Run:
isql <dbname>
Doesn't have command-line completion, but has history. Can be
fussy on some terminal types.
Firebird databases are usually self-contained in a single file
residing anywhere in the filesystem. This database file can be
manipulated with usual file-related utilities, but there are several
special commands such as the "gbak" which produces a backup-ready
snapshot of the database.
## Get list of tables
Doesn't support standard information schema but has its own version
of data dictionary.
In the isql utility,
SHOW TABLE;
will list existing user tables, and
SHOW INDEX
will list existing user indexes.
## Getting a table description
Doesn't support standard information schema, in isql you can run:
SHOW TABLE "tablename";
to examine table structure, or
SHOW INDEX "indexname"
to examine an index.
Any user-creatable objects can be examined with "SHOW <TYPE> <ITEMNAME>"
command.
## Telling the DBMS to collect statistics
Can only manually compute statistics on indexes, with
SET STATISTICS INDEX "name";
command.
## Getting a query explanation
In isql, use
SET PLAN;
or
SET PLANONLY;
to set/reset display of query executor plan;
## Turning on query timing
No such functionality exists.
FireBird 1.5, and I'd like to check with more experienced users if I
missed something:
(You'll have to read it in parallel with the above web page)
## Legend, definitions, and notes
Firebird:
Firebird version 1.5.2 on FreeBSD; The core features are a superset
of Borland Interbase 6.0, with many bug fixes and SQL compliance
enhancements.
## Features - Views:
Conforms to at least SQL-92.
## Join types and features:
Natural joins: NO
USING-clause: NO
FULL joins: YES
Explicit CROSS JOIN: NO
## The SELECT statement
### Ordering result sets:
Allows ORDER BY in contexts other than cursor definitions.
NULLs are considered lower than any non-NULL value.
### Limiting result sets:
Doesn't support ROW_NUMBER(), supports cursors in all contexts.
Alternative to ROW_NUMBER():
SELECT FIRST x columns
FROM tablename
ORDER BY key ASC
### Top-n query:
Supports the slow standard SQL query variant only.
### Limit-with-offset
Doesn't support ROW_NUMBER(), provides alternative syntax:
SELECT FIRST x SKIP y columns
FROM tablename
ORDER BY key ASC
## The INSERT statement
### Inserting several rows at a time: NO
## Data types
### The BOOLEAN type
Doesn't support BOOLEAN type, possible alternative CHAR(1) with
constraints.
### The CHAR type
Follows the standard.
### The TIMESTAMP type
Follows the standard, but doesn't implement WITH TIMEZONE.
Standard sanity checks pass.
## SQL Functions
### CHARACTER_LENGTH
Firebird is extremely poor on built-in SQL functions (this situation
is remedied in latest 2.0-alpha). CHARACTER_LENGTH() function doesn't
exist and there's no similar functionality.
### SUBSTRING
Only ordinary SUBSTRING variant exists.
### REPLACE
No such functionality exists.
### TRIM
No such functionality exists.
### LOCALTIMESTAMP
No such functionality exists.
### Concatenation
Automatically casts the concatenated values into types compatible
with concatenation. If an operand is NULL then the result is NULL.
## Constraint handling
### UNIQUE constraint
Follows the standard, including the optional NULLs allowed feature.
## Mixture of type and operators
### Automatic key generation
Doesn't support standard IDENTITY attribute, but allows simulation of
BY DEFAULT or even ALWAYS behaviour with triggers and Generators:
CREATE GENERATOR EMPNO_GEN;
CREATE TRIGGER CREATE_EMPNO FOR EMPLOYEES
BEFORE INSERT
AS BEGIN
NEW.EMPNO = GEN_ID (EMPNO_GEN, 1);
END;
## Command-line procedures
Run:
isql <dbname>
Doesn't have command-line completion, but has history. Can be
fussy on some terminal types.
Firebird databases are usually self-contained in a single file
residing anywhere in the filesystem. This database file can be
manipulated with usual file-related utilities, but there are several
special commands such as the "gbak" which produces a backup-ready
snapshot of the database.
## Get list of tables
Doesn't support standard information schema but has its own version
of data dictionary.
In the isql utility,
SHOW TABLE;
will list existing user tables, and
SHOW INDEX
will list existing user indexes.
## Getting a table description
Doesn't support standard information schema, in isql you can run:
SHOW TABLE "tablename";
to examine table structure, or
SHOW INDEX "indexname"
to examine an index.
Any user-creatable objects can be examined with "SHOW <TYPE> <ITEMNAME>"
command.
## Telling the DBMS to collect statistics
Can only manually compute statistics on indexes, with
SET STATISTICS INDEX "name";
command.
## Getting a query explanation
In isql, use
SET PLAN;
or
SET PLANONLY;
to set/reset display of query executor plan;
## Turning on query timing
No such functionality exists.