Oracle Chapter III--sql language

Source: Internet
Author: User

SQL language is a high-level structured query language, which greatly reduces the burden on users. Currently the query language is divided into four types, data definition language (DDL), Data Manipulation language (DML),

Transaction Control Language (TCL), Data Control Language (DCL).

One, data definition language (DDL)

1. CREATE

The Create command is used to create a schema object, such as creating a table in the Format: CREATE table [schema.] Table (column datatype [, column datatype]);

Schema is the owner of the object, that is, the user's corresponding pattern, if created in the user's own mode can not be specified, table is the name of the tables, column is the name, datatype is the data type.

2. ALTER

The ALTER command is used to change the pattern object, such as changing the table format to: ALTER TABLE [schema.] Table Add (column datatype [, column datatype]);

The meaning of the keyword is the same as the Create command.

3. DROP

The drop command is used to delete a schema object, such as dropping a table in the form of a drop tables table;.

4, TRUNCATE

The TRUNCATE command is used to truncate the contents of the table in the following format: TRUNCATE table table;. (The difference between the truncate command and the Delete command is explained when you introduce the delete command).

Ii. Data Manipulation Language (DML)

1. INSERT

The insert command is used to add data to the table in the format: INSERT into table (Column[,column]) VALUES (Value,[value]), where table is the name

column names, value values, values correspond to columns, column names are not written, and values are added by default in the order of the columns in the table.

2. DELETE

The delete command deletes the data in the table in the following format: Delete table [WHERE condition];,where is followed by a condition, you can have more than one. Delete with the truncate command.

Difference: Delete command can delete data according to conditions, delete data will log, truncate command delete full table data, delete data will not log, thus, delete full table data

, the truncate command is faster and more resource-efficient, however, because the deleted data cannot be retrieved without logging, use caution.

3. UPDATE

The Updte command modifies the data in the table in the format: UPDATE table SET column=value[,column=value] [WHERE condition];.

4. SELECT

The Select command is used to query the data in the table in the format: SELECT Column[,column] FROM table [WHERE condition];

Third, the transaction control Language (TCL)

1. COMMIT

The commit command is used to commit a transaction in the form of commit, and commits the transaction to permanently save the modifications to the database.

2, SavePoint

The savepoint command is used to set the save point in the format: SavePoint <savepoint_name>;, where Savepoint_name is the name of the savepoint.

3, ROLLBACK

The ROLLBACK command is used to roll back a transaction in the form of: ROLLBACK [to <savepoint_name>]; the name of the save point will roll back the entire transaction, and the write will roll back to the savepoint.

Rollback will revoke changes to the database.

Iv. Data Control Language (DCL)

1. GRANT

The grant command is used to grant a user a permission or role in the format: Grant permission | role to user name; The grant command will give the user a certain permission or role.

2, REVOKE

The REVOKE command is used to revoke a user's permission or role in the format: REVOKE permission | Role from user name, and REVOKE command will no longer have a permission or role for the user.

Oracle Chapter III--sql language

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.