Oracle entry-level table management

Source: Internet
Author: User

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

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.