SQL Statements
The primary structure of a SQL query is its statement. Whether a statement stands on its own, or is part of a multi-statement query, each statement must end with a semicolon. The following example contains four common SQL statements—CREATE TABLE, INSERT, SELECT, and COMMIT:
=> CREATE TABLE comments (id INT, comment VARCHAR); CREATE TABLE => INSERT INTO comments VALUES (1, 'Hello World'); OUTPUT -------- 1 (1 row) => SELECT * FROM comments; id | comment ----+------------- 1 | Hello World (1 row) => COMMIT; COMMIT =>