Basic oracle syntax (1)

Source: Internet
Author: User
Createuserdraem0507identifiedbytest; -- creates a user and password grantconnect, resourcetodraem0507; -- authorizes conndraem0507test to connect to and process transactions; -- log on to * Create a new table ** using draem0507. The main function of the table created with as is to import table data * createtablet_testass

Create user draem0507 identified by test; -- create a user and password grant connect, resource to draem0507; -- authorize the connection and transaction processing permissions conn draem0507/test; -- Log On as A draem0507 user/* create a new table * // The table created with as is mainly used to import table data */create table t_test as s

Create user draem0507 identified by test; -- create a user and password

Grant connect, resource to draem0507; -- authorize the connection and transaction processing Permissions

Conn draem0507/test; -- Log On As A draem0507 user

/* Create a new table */

/* The main function of a table created with as is to import table data */

Create table t_test as select a. id, a. name new_name from t_test_old;

/* Tables created with like mainly import the table structure */

Select table t_test2 like t_test_old; -- oracle does not support like.

/* Drop table */

Drop table t_test; -- delete the entire table

Delete table t_test; -- only deletes data, and the truncate cannot be recovered.

Alter table t_test add (new_col type [, new_col2 type]) -- add a column

Alter table t_test drop drop_col; -- delete a column

Alter table t_test rename column old_name to new_col_name; -- change the field name

Alter table t_test modify change_type_col newtype; -- change the field type

Alter table t_test add primary key (nno); -- add a field primary key

Alter table t_test drop primary key (nno); -- delete the field primary key

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.