Oracle Database-A brief introduction to data definition language ____ Database

Source: Internet
Author: User
Tags oracle database
------------------Data Definition language-------------Data Definition language (language, DDL) completes creation, deletion, and modification of tables, views, indexes, users, and so on.
--createTo create a table format:
--create table < table name > (< column name >< data type >[column-level integrity constraints)
--[,< Column name >< data type >[column-level integrity constraint] ...
--[,< Column name >< data type >[column-level integrity constraints]);
To create a view:
--create View < view name > [(< column name >[,< column name] ...)]
--as < subqueries >
--[with CHECK OPTION]
[with CHECK OPTION] means that the update\insert\delete row satisfies the predicate condition in the view definition (that is, the conditional statement in the subquery) when the update\insert\delete operation is performed on the visual.
When you enter a property column name that makes up a view, either all is omitted or all is specified, and there is no third case.
When you omit individual property columns for a view, each property column name is implied in the SELECT clause target column in the view subquery.
However, in the following three cases, you must explicitly specify all the column names that make up the view:
1. When a set function or column expression exists for the destination column, the column name needs to be specified.
2. Multiple table joins have several fields with the same names as views, and you need to specify a different column name.
3. A column needs to be renamed.


--dropDelete table: Drop table < table name >;
When you delete a table, the data in the table, and the indexes that are established on the table, are also deleted.
The view definition that is established on the base table after it is deleted in Oracle remains in the data dictionary, and an error occurs when the user references the view.
Delete view: Drop View < view name >;


--alter--alter Table < name >
--[add < new column name > < data type >[integrity constraint] Add column
--[drop column Name]; Delete Column
--[modify < column name >< data type >]; Modify the data type or data type definition length of a column
--[drop < integrity constraint removes the specified integrity constraint

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.