Create Table
Creates a table within a database.
CREATE TABLE <table> (
<fields>
)
Reference
You can include a primary key reference by doing:
CREATE TABLE <table> (
<field> <type> REFERENCES <table>,// inlined, assumes column name
<field> <type> REFERENCES <table> <field>,// inlined, asserted column name
// constraint (additional)
CONSTRAINT <constraint_name>
FOREIGN KEY (<field>)
REFERENCES <table> (<field>)
)
// constraint (alter)
ALTER TABLE <table>
ADD CONSTRAINT fk_tests_students
FOREIGN KEY (<field>)
REFERENCES <table> (<field>);
Example
CREATE TABLE Employe (
ID BIGINT PRIMARY KEY NOT NULL,
Name TEXT NOT NULL,
Start TIMESTAMP NOT NULL
)