Portable SQL/Common/DBMS Differences

From Linuxnetworks
< Portable SQL
Revision as of 14:00, 3 September 2006 by Nose (Talk | contribs)

Jump to: navigation, search


Differences between implementations

NULL in column definition

This table is originally from "Building Truly Portable Database Applications in PHP": NULL

Database Default value Definition allowed Notes
Firebird NULL no
MySQL NULL yes
Oracle NULL yes Empty strings considered NULL
PostgreSQL NULL yes
SQL Server NOT NULL yes
SQLite NULL yes
Sybase ASE NOT NULL yes

The "Definition allowed" column indicates if specifying NULL in table column definitions is allowed for CREATE TABLE statements - NOT NULL is always allowed. If "yes", the following statement doesn't generate an error:

CREATE TABLE mytable ( id INTEGER NULL )