SQL as a Data Definition Language (CREATE, ALTER, DROP, RENAME, TRUNCATE, COMMENT) :

Data Definitions Language are used to define the metadata of the database. Data Definition Language(DDL) is a standard for commands that define the different structures in a database. DDL statements create, modify and remove database objects such as tables, indexes, and users. Common DDL statements are CREATE, ALTER and DROP. It is also used to specify the structure of each table, set of associated values with each attribute, integrity constraints, security and authorization information for each table and physical storage structure of each table on disk. The CREATE, ALTER, and DROP, RENAME commands require exclusive access to the specified object, while Comment command do not 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.  DDL statements are :

DDL Statement Usage
CREATECreate schema objects
ALTERAlter schema objects
DROPDelete schema objects
RENAMERename schema objects
CommentAdd a comment to the data dictonary
TRUNCATERemove all records from a table

CREATE :   Create is a DDL command used to create a table or a database.

ALTER : The ALTER TABLE statement to alter the structure of a table.

DROP, RENAME, TRUNCATE and COMMENT :  The DROP command is used to drop or delete tables, RENAME command is used to rename a table and TRUNCATE command is used to delete all the rows of an existing table.

Next Topic :

No comments:

Post a Comment