Common SQL statements for Oralce table operations

Source: Internet
Author: User

Common SQL statements for Oralce table operations [SQL] -- Create table create table table_name (id VARCHAR2 (50), create_time TIMESTAMP (6), column_name NUMBER )); -- alter table table_name modify column_name number (); -- Create table partition by range (CREATE_TIME) (partition PAR_2013_04_01 values less than (TIMESTAMP '00:00:00 ') tablespace tablespace_name pctfree 10 initrans 1 maxtrans 255 storage (initial 8 M next 1 M minextents 1 maxextents unlimited), partition PAR_2013_05_01 values less than (TIMESTAMP '00:00:00 ') tablespace tablespace_name pctfree 40 initrans 1 maxtrans 255); -- Add comments to the columns Add comment on column table_name.create_time is 'creation time'; comment on column table_name.column_name is 'column name '; -- create index IDX_name on table_name (CREATE_TIME) local; create INDEX IDX_NAME on table_name (CREATE_TIME, NVL (COLUMN_NAME, 0 )) tablespace TS_NAME pctfree 0 initrans 2 maxtrans 255 storage (initial 64 K next 1 M minextents 1 maxextents unlimited); -- Create/Recreate primary, unique and foreign key constraints alter table table_name add constraint PK_NAME primary key (ID, CREATE_TIME) using index local; create unique INDEX PK_table_name on table_name (ID, CREATE_TIME) local; -- Grant/Revoke object privileges grant the user the permission to Grant select, insert, update, delete on table_name to userName;

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.