码迷,mamicode.com
首页 > 数据库 > 详细

【ORACLE】DDL包括哪些操作

时间:2020-04-13 16:52:20      阅读:299      评论:0      收藏:0      [点我收藏+]

标签:access   for   tin   sub   example   row   update   ora   int   

(一) Data Manipulation Language (DML) Statements

Data manipulation language (DML) statements query or manipulate data in existing schema objects.

Whereas DDL statements change the structure of the database, DML statements query or change the contents. For example, ALTER TABLE changes the structure of a table, whereas INSERT adds one or more rows to the table.

DML statements are the most frequently used SQL statements and enable you to:

  • Retrieve or fetch data from one or more tables or views (SELECT).

  • Add new rows of data into a table or view (INSERT) by specifying a list of column values or using a subquery to select and manipulate existing data.

  • Change column values in existing rows of a table or view (UPDATE).

  • Update or insert rows conditionally into a table or view (MERGE).

  • Remove rows from tables or views (DELETE).

  • View the execution plan for a SQL statement (EXPLAIN PLAN).

  • Lock a table or view, temporarily limiting access by other users (LOCK TABLE).

DML statements do not implicitly commit the current transaction.

 

(二) Data Definition Language (DDL) Statements

 

Data definition language (DLL) statements define, structurally change, and drop schema objects.

DDL enables you to alter attributes of an object without altering the applications that access the object. For example, you can add a column to a table accessed by a human resources application without rewriting the application. You can also use DDL to alter the structure of objects while database users are performing work in the database.

More specifically, DDL statements enable you to:

  • Create, alter, and drop schema objects and other database structures, including the database itself and database users. Most DDL statements start with the keywords CREATEALTER, or DROP.

  • Delete all the data in schema objects without removing the structure of these objects (TRUNCATE).

 

  • Unlike DELETETRUNCATE generates no undo data, which makes it faster than DELETE. Also, TRUNCATE does not invoke delete triggers

  • Grant and revoke privileges and roles (GRANTREVOKE).

  • Turn auditing options on and off (AUDITNOAUDIT).

  • Add a comment to the data dictionary (COMMENT).

DDL statements implicitly commit the preceding and start a new transaction.

 

 

(三) Transaction Control Statements

Transaction control statements manage the changes made by DML statements and group DML statements into transactions.

These statements enable you to:

  • Make changes to a transaction permanent (COMMIT).

  • Undo the changes in a transaction, since the transaction started (ROLLBACK) or since a savepoint (ROLLBACK TO SAVEPOINT). A savepoint is a user-declared intermediate marker within the context of a transaction.

  • Set a point to which you can roll back (SAVEPOINT).

  • Establish properties for a transaction (SET TRANSACTION).

  • Specify whether a deferrable integrity constraint is checked following each DML statement or when the transaction is committed (SET CONSTRAINT).

 

 

(四)  Session Control Statements

Session control statements dynamically manage the properties of a user session.

A session is a logical entity in the database instance memory that represents the state of a current user login to a database. A session lasts from the time the user is authenticated by the database until the user disconnects or exits the database application.

Session control statements enable you to:

  • Alter the current session by performing a specialized function, such as setting the default date format (ALTER SESSION).

  • Enable and disable roles, which are groups of privileges, for the current session (SET ROLE).

Session control statements do not implicitly commit the current transaction.

 

(五)  System Control Statement

A system control statement changes the properties of the database instance.

  • The only system control statement is ALTER SYSTEM. It enables you to change settings such as the minimum number of shared servers, terminate a session, and perform other system-level tasks.

The ALTER SYSTEM statement does not implicitly commit the current transaction.

【ORACLE】DDL包括哪些操作

标签:access   for   tin   sub   example   row   update   ora   int   

原文地址:https://www.cnblogs.com/CL-learning/p/12692176.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!