Table of Contents Previous Next


2 SQL Tutorial : 2.1 Getting Started : 2.1.2 Creating a New Table

You can enter this into PSQL with line breaks. PSQL will recognize that the command is not terminated until the semicolon.
White space (i.e., spaces, tabs, and newlines) may be used freely in SQL commands. That means you can type the command aligned differently than the above, or even all on one line. Two dashes ("--") introduce comments. Whatever follows them is ignored up to the end of the line. SQL is case insensitive about key words and identifiers, except when identifiers are double-quoted to preserve the case (not done above).
VARCHAR2(10) specifies a data type that can store arbitrary character strings up to 10 characters in length. NUMBER(7,2) is a fixed point number with precision 7 and scale 2. NUMBER(4) is an integer number with precision 4 and scale 0.
Advanced Server supports the usual SQL data types INTEGER, SMALLINT, NUMBER, REAL, DOUBLE PRECISION, CHAR, VARCHAR2, DATE, and TIMESTAMP as well as various synonyms for these types.
DROP TABLE tablename;

2 SQL Tutorial : 2.1 Getting Started : 2.1.2 Creating a New Table

Table of Contents Previous Next