You can create a new table by specifying the table name and the names and types of all columns in the table.

The following table is a simplified version of the emp sample table. Only the basic information is provided to define a table.

    empno           NUMBER(4),
    ename           VARCHAR2(10),
    job             VARCHAR2(9),
    mgr             NUMBER(4),
    hiredate        DATE,
    sal             NUMBER(7,2),
    comm            NUMBER(7,2),
    deptno          NUMBER(2)

You can enter the sample code into PSQL with line breaks. PSQL recognizes that the statement is not terminated until the semicolon.

Whitespace characters such as blanks, tabs, and newlines may be used in SQL statements. Therefore, you can type the statement aligned differently from the preceding example. You can also type the statement on one line. Two dashes (--) introduce comments. Whatever follows the dashes is ignored up to the end of the line. Keywords and identifiers are case insensitive in SQL, except when identifiers are double-quoted to preserve the case. No double-quoted identifiers are used in the preceding example.

VARCHAR2(10) specifies a data type that can store arbitrary character strings with 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.

PolarDB databases compatible with Oracle support common SQL data types including INTEGER, SMALLINT, NUMBER, REAL, DOUBLE PRECISION, CHAR, VARCHAR2, DATE, and TIMESTAMP, and also support various synonyms for these types.

If you do not need a table or you want to create a new table to replace the table, you can remove the table by running the following statement:

DROP TABLE tablename;