Computer

Difference Between DDL And TCL

Difference Between DDL And TCL

Data Definition Language (DDL) is the language of data creation; it is what we use to describe tables, indexes, views, partitions, and so on. For example: build a table, modify table are a few of SQL’s DDL instructions.

Transaction Control Language (TCL), as the name implies, includes certain commands that are used inside the database to handle transactions.

The key difference between DDL and TCL:

Data Definition Language (DDL) –

DDL essentially presents the database schema outline where it defines and modifies the database object structure on the database.

Database transactions cannot be done by using the DDL commands.

Files can be easily maintained by DDL commands.

Some examples of DDL are:

  • CREATE – to create objects in the database
  • ALTER – alters the structure of the database
  • DROP – delete objects from the database
  • TRUNCATE – delete from a table all records including all spaces assigned to records
  • COMMENT – add comments to the data dictionary
  • RENAME – rename an object

Usually, DDL statements are written prior to TCL statements when writing any query.

To manage the database DDL does not need any log files.

Transaction Control Language (TCL) –

TCL deals with Database transactions.

TCL commands are intended to manage transfers to the database.

With its essential function, Atomicity, TCL manages the various tasks.

TCL provides for the classification of statements into logical transactions.

  • COMMIT – save work done
  • SAVEPOINT – identify a point in a transaction to which you can later rollback
  • ROLLBACK – restore database to original since the last COMMIT
  • SET TRANSACTION – change transaction options like the level of isolation and what portion of the rollback to use

Usually, TCL statements are written before DDL statements.

TCL uses log files to keep track of all transactions documented within a database.

 

Information Sources:

  1. tutorialspoint4all.com
  2. geeksforgeeks.org