Basic Oracle Tutorial: SQL Structured Query statements

Source: Internet
Author: User

Structured Query Language
There are four types of statements:
Data Query Language DQL-Data Query Language SELECT
Data Manipulation Language DML-Data Manipulation Language INSERT, UPDATE, DELETE
Data Definition Language DDL-Data Definition Language CREATE, ALTER, DROP
Data Control Language DCL-Data Control Language GRANT REVOKE
Transaction control statement TCL-Transacation Contrl Language COMMIT, ROLLBACK

DQL
Select

1. Data Definition Language DDL
DDL (Data Definition Language) is used to define/modify/Delete the Data structure of Data objects (such as tables), or, the objects operated by the DDL language are the objects in the database, not the data contained by the objects.

DDL includes the following statements:

CREATE: CREATE a data object in the database
ALTER: Modify the data structure of objects in the database
DROP: delete objects in the database
DISABLE/enable trigger: Modify the TRIGGER status
Update statistic: UPDATE table/View statistics
Truncate table: Clear TABLE data
COMMENT: add comments to Data Objects
RENAME: Change the Data Object Name
2. Data Operation Language DML
DML (Data Manipulation Language) is used to add/modify/query Data in the database.

DML contains the following statements:

INSERT: INSERT data into a table or view.
DELETE: deletes data from a table or view.
SELECT: obtain data from a table or view
UPDATE: UPDATE data in a table or view.
MERGE: MERGE data (insert/update/delete)
3. Data Control Language DCL
DCL (Data Control Language) is used to grant/Revoke Control permissions on Data objects to users.

DCL contains the following statements:

GRANT: GRANT the user certain control permissions.
REVOKE: cancels a user's control permission.
4. Transaction Control Language (TCL)
Transaction Control Language (TCL) is used to manage transactions.

TCL contains the following statements:

COMMIT: Save the results of the completed transaction action
SAVEPOINT: stores transaction-related data and States for possible rollback operations
ROLLBACK: Restores transaction-related data after the previous COMMIT operation.
Set transaction: set transaction options
The most complex one is the select statement of the DQL Data Query Language.

How to Write DQL_ SQL
The case is not sensitive, but the case sensitivity of single and double quotes.
Select cannot be abbreviated as sel.
For example, ename = 'seker'
Column alias with double quotation for special characters
Cross-row is supported, but do not include keywords or single-cited content.
Cross-row is for readability. Generally, we write the select clause and the from clause into different lines.

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.