SQL
zoo.net
CREATE a table with an autonumber / sequence / identity / autoincrement
SQLite
DB2
Access
Postgres
Oracle
SQL Server
MySQL
Mimer
Sybase
Oracle
An auto number field can provide a unique identifier where no other is available.
Execute tidy up
code
silently
DROP TABLE t_test; DROP sequence sq
CREATE SEQUENCE sq; CREATE TABLE t_test( id INTEGER PRIMARY KEY, name VARCHAR(10) ); INSERT INTO t_test(id,name) VALUES (sq.nextval,'Andrew'); INSERT INTO t_test(id,name) VALUES (sq.nextval,'Gordon'); SELECT * FROM t_test;
Specific to Oracle
SEQUENCE nextval
Related links:
CREATE, DROP and ALTER
CREATE a new table
DROP an unwanted table
Composite primary key
Composite foreign key
CREATE a VIEW.
Create a table with an autonumber field (also known as sequence, identity)
ALTER TABLE ... ADD COLUMN
ALTER TABLE ... DROP COLUMN
ALTER TABLE ... ADD constraint
CREATE TABLE problems: Invalid column name.
CREATE TABLE problems: Insufficient privileges.
CREATE TABLE problems: Table already exists.
DROP TABLE problems: Foreign key references.
CREATE TABLE problems: Foreign key references.
rename column