Monday 13 August 2012

What is TCL?


TCL Stands for...Transaction Control Language
  • TCL is a subset of SQL,
  • TCL helps to control the Transaction process in RDBMS.
TCL commands includes,
  • Begin Transaction - Marks the starting point of transaction.
  • Commit Transaction - Marks the end of a successful implicit or explicit transaction.
  • Rollback Transaction - Rolls back an explicit or implicit transaction to the beginning of the transaction

What is Transaction in SQL?

A transaction is a sequence of operations performed as a single logical unit of work, usually a group of DML statements.

A logical unit of work must follow four properties to qualify as a transaction,
  • Atomicity,
  • Consistency,
  • Isolation,
  • and Durability
These Properties are called as Transaction Property, Some people will call as ACID Property.

Atomicity: A transaction must be an atomic unit of work; either all of its data modifications are performed or none of them is performed.

Consistency: When completed, a transaction must leave all data in a consistent state. In a relational database, all rules must be applied to the transaction's modifications to maintain all data integrity. All internal data structures, such as B-tree indexes or doubly-linked lists, must be correct at the end of the transaction.

Isolation: Modifications made by concurrent transactions must be isolated from the modifications made by any other concurrent transactions. A transaction either sees data in the state it was in before another concurrent transaction modified it, or it sees the data after the second transaction has completed, but it does not see an intermediate state. This is referred to as serializability because it results in the ability to reload the starting data and replay a series of transactions to end up with the data in the same state it was in after the original transactions were performed.

Durability: After a transaction has completed, its effects are permanently in place in the system. The modifications persist even in the event of a system failure.

Sunday 12 August 2012

What is DML?


DML Stands for... Data Manipulation Language
  • DML is a language of SQL, It will be supported by RDBMS System
  • DML is helps to manipulate the data into relational database
  • DML modify the stored data (not the structure of DB object) in the database
  • DML is purely handling the data in the database in different ways like loading/removing/modifying the data in the database
Following SQL commands are part of DML
SELECT
SELECT ... INTO (It is exists in DDL & DML)
INSERT INTO
UPDATE
DELETE
TRUNCATE
Data manipulation languages are mainly classified as 2 type, procedural programming and declarative programming.

Procedural Programming : Collection of SQL Statements
Declarative Programming: The individual SQL statements are declarative

Tuesday 7 August 2012

What is DDL?


DDL Stands For...
Data Definition Language (or)
Data Description Language

Ø  DDL is a kind of programming language which helps to create Database objects like ...
Table
Columns
object Relationships
Views
Procedures
Functions
Indexes
Packages
Triggers
Types
Synonyms
Database
Linked Objects
Security
etc.,
Ø  The Script which is used to create db objects like above also called as Schema which will be stored in Data Dictionary
Ø  DDL will be supported by Database Management Systems (DBMS)
Ø  The script which helps to create/define/Modify/Remove an objects in DB will be part of DDL
Ø  Following are the general DDL Commands...
o    CREATE - To create New objects in a database
o    ALTER - Modify the structure of Existing objects database
o    DROP - Delete/Remove an objects from the database
o    TRUNCATE - Remove the data page which is attached to a table object,
o    COMMENT - Add comments to the Data dictionary
o    RENAME - rename an Existing DB object
o    SELECT ... INTO - Creating new object by using existing object schema, it will not capture identity definition and field relationship