How to add a Column to a Table in Oracle

Here is the statement to add a column to a table.

ALTER TABLE SAMPLE_TABLE ADD  ANOTHER_DATE DATE;

Here is the statement to add multiple columns to a table.

ALTER TABLE SAMPLE_TABLE ADD (
ANOTHER_STRING VARCHAR2(100 CHAR),
ANOTHER_NUMBER NUMBER(32,12)
);

 

How to Truncate a Table in Oracle

Here is an example of how to truncate a table in Oracle.  To do a truncate, you must be connected to the schema the table is in.

TRUNCATE TABLE SAMPLE_TABLE;

How to Delete Data from a Table in Oracle

Here is an example of how to delete data from a table.  To do a delete, you must do a commit for the delete to be permanent.  You can do a delete in any schema that has access to the necessary table. 

DELETE FROM SAMPLE_TABLE;
COMMIT;

Here is an example of how to delete data from a table by using a filter. 

DELETE FROM SAMPLE_TABLE WHERE SOME_NUMBER = 20;
COMMIT;

How to Create a Copy of a Table in Oracle

Here is how to create a backup of an existing table (with data).

CREATE TABLE SAMPLE_TABLE_COPY AS SELECT * FROM SAMPLE_TABLE;

Here is how to create a backup of an existing table (without data).

CREATE TABLE SAMPLE_TABLE_COPY AS SELECT * FROM SAMPLE_TABLE WHERE ROWNUM < 1;