A table is the most basic logical unit for storing data in a database. It consists of rows and columns. Oracle divides the table into heap table and index organization table (IOT) and temporary table (temporary table) This section briefly introduces the oracle table management (heap table), mainly including adding, deleting columns, changing column names, table names; creating the same table, set the table to read-only and read/write modes, Delete tables, and perform other operations
1: add columns
Yang SQL> select * from test order by 1;
ID BANNER
------------------------------------------
1 one
2 two
3 three
4 four
Yang SQL> alter table test add (address varchar (10 ));
Table altered.
Yang SQL> desc test;
Name Null? Type
-----------------------------------------------------------------------------
Id number (38)
BANNER VARCHAR2 (32)
ADDRESS VARCHAR2 (10)
2: delete Columns
Yang SQL> alter table test drop (address );
Table altered.
Yang SQL> desc test;
Name Null? Type
-----------------------------------------------------------------------------
Id number (38)
BANNER VARCHAR2 (32)
Yang SQL> alter table test rename column id to num;
Table altered.
3: Change the column name
Yang SQL> desc test;
Name Null? Type
-----------------------------------------------------------------------------
Num number (38)
BANNER VARCHAR2 (32)
Yang SQL> alter table test rename to t1;
Table altered.
4. Change the table name.
Yang SQL> desc t1;
Name Null? Type
-----------------------------------------------------------------------------
Num number (38)
BANNER VARCHAR2 (32)
5. Create the same table. When creating a large table, you can increase the concurrency and disable the log to Improve the efficiency.
Yang SQL> create table emp as select * from t1; // crate table emp nologing parallel (degree 4) as select * from t1;
Table created.
Yang SQL> select * from emp order by 1;
NUM BANNER
------------------------------------------
1 one
2 two7
3 three
4 four