The SQL standard and most databases support the DEFAULT VALUES
clause for this:
INSERT INTO "MIGRATION"."VERSION" DEFAULT VALUES;
This is supported in
- CUBRID
- Firebird
- H2
- HSQLDB
- Ingres
- PostgreSQL
- SQLite
- SQL Server
- Sybase SQL Anywhere
If the above is not supported, you can still write this statement as a workaround. In fact, the first is specified by the SQL standard to be equivalent to the second:
INSERT INTO "MIGRATION"."VERSION" (ID, VERSION_DATE) VALUES (DEFAULT, DEFAULT);
This will then also work with:
- Access
- DB2
- MariaDB
- MySQL
- Oracle
For more details, see this blog post here:
http://blog.jooq.org/2014/01/08/lesser-known-sql-features-default-values/