Introduction to Data Definition Language in SQL
Data definition language in SQL is abbreviated as DDL. It is also called as data descriptive languages. Now the question arises what is DDL?
DDL statements are used to create and modify database objects such as tables, indexes, and users.
So the commands used in data definition language is as follows:-
create command is used to make a new database also for entities like (table, index, views, store procedure, function, and triggers).
We can simply create a new database. Also, a new table using create command.
The syntax for Create command
Create table table_name (col1_name data type key,col2_name data type key);
Salary_details table is created successfully.
Widget not in any sidebars
alter command is used to change the structure of the existing database or tables. We can make random changes in the database using alter command.
Syntax of altering command
Alter table tablename;
Example:-alter table salary_details Add column name Datatype;
• DROP – Drop command is basically used for delete objects or content from the database
• TRUNCATE -Truncate command is used to remove all records from a table, including all spaces allocated for the records are removed.
• COMMENT – Comment is used to just add comments to the data dictionary
• RENAME – Rename command is used to rename a particular row or column name with respect to the table.Rename an particular entity.