Oracle (2) DDL statements create, alert, drop, and truncate

Source: Internet
Author: User

Oracle (2) DDL statement create, alert, drop, truncate II. data Definition (DDL) Section www.2cto.com 1. CREATE (create table, index, view, synonym, process, function, database link, etc.) Common ORACLE field types include CHAR fixed length string VARCHAR2 Variable Length string www.2cto.com NUMBER (M, n) number M indicates the total length of digits, and N indicates the length of decimal places. When creating a table of the DATE type, we need to put a smaller field that is not empty in front, the field names that may be blank can be used to create a table later than the field names in Chinese. However, it is best to add the default value to the field when creating a table using the field names in English, for example, if the default sysdate parameter is used for each insert or modification, you do not need to perform any program operation on this field to obtain the operation time. When creating a table, you can add constraints to the field. For example, duplicate UNIQUE is not allowed, key word PRIMARY KEY2. ALTER (change TABLE, index, view, etc.) a. Change TABLE name alter table name 1 to table name 2; b. ADD a field ALTER TABLE name ADD field name (column) Field Name Description after the TABLE; c. MODIFY the definition description of the field in the TABLE ALTER TABLE name MODIFY Field Name field name description; d. ADD constraints to the fields in the TABLE: alter table name add constraint name primary key (field name); alter table name add constraint name UNIQUE (field name ); put the TABLE in or out the database's memory zone alter table name CACHE; alter table name NOCACHE; 3. DROP (delete TABLE, index, view, synonym, process, function, database link, etc.) delete a TABLE and all its constraints drop table name cascade constraints; 4. TRUNCATE (clear all records in the table and keep the table structure) the name of the TRUNCATE table;

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.