0
6.8kviews
Discuss Data Definition and Manipulation Commands in SQL.
1 Answer
0
122views

SQL commands:

  • SQL commands are instructions, coded into SQL statements, which are used to communicate with the database to perform specific tasks, work, functions and queries with data.
  • SQL commands can be used not only for searching the database but also to perform various other functions like, for example, you can create tables, add data to tables, or modify data, drop the table, set permissions for users.
  • SQL commands are grouped into four major categories depending on their functionality:

Data Definition Language (DDL)

Data definition language (DDL) statements let you to perform these tasks:

  • Create, alter, and drop schema objects
  • Grant and revoke privileges and roles
  • Analyze information on a table, index, or cluster
  • Establish auditing options
  • Add comments to the data dictionary

The CREATE, ALTER, and DROP commands require exclusive access to the specified object.

For example,

  • An ALTER TABLE statement fails if another user has an open transaction on the specified table.

  • The GRANT, REVOKE, ANALYZE, AUDIT, and COMMENT commands do not require exclusive access to the specified object. For example, you can analyze a table while other users are updating the table.

  • Oracle Database implicitly commits the current transaction before and after every DDL statement.

  • Many DDL statements may cause Oracle Database to recompile or reauthorize schema objects. For information on how Oracle Database recompiles and reauthorizes schema objects and the circumstances under which a DDL statement would cause this, see Oracle Database Concepts.

  • DDL statements are supported by SQL with the use of the DBMS_SQL package.

The commands are :

  1. ALTER ... (All statements beginning with ALTER)

  2. ANALYZE

  3. ASSOCIATE STATISTICS

  4. AUDIT

  5. COMMENT

  6. CREATE ... (All statements beginning with CREATE)

  7. DISASSOCIATE STATISTICS

  8. DROP ... (All statements beginning with DROP)

  9. FLASHBACK ... (All statements beginning with FLASHBACK)

  10. GRANT

  11. NOAUDIT

  12. PURGE

  13. RENAME

  14. REVOKE

  15. TRUNCATE

  16. UNDROP

Data Manipulation Language (DML)

  • Data manipulation language (DML) statements access and manipulate data in existing schema objects. These statements do not implicitly commit the current transaction.

  • These Data Manipulation Language commands are:

  1. CALL

  2. DELETE

  3. EXPLAIN PLAN

  4. INSERT

  5. LOCK TABLE

  6. MERGE

  7. SELECT

  8. UPDATE

    • The SELECT statement is a limited form of DML statement in that it can only access data in the database. It cannot manipulate data in the database, although it can operate on the accessed data before returning the results of the query.

    • The CALL and EXPLAIN PLAN statements are supported in PL/SQL only when executed dynamically. All other DML statements are fully supported in PL/SQL.

Please log in to add an answer.