what is DDL mention any two DDL statement
Answers
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.
SQL >
DDL Commands - Create - Drop - Alter - Rename - Truncate
DDL Commands
DML Commands
DCL Commands
TCL Commands
Data Constraints
The Create Table Command
The create table command defines each column of the table uniquely. Each column has minimum of three attributes.
Name
Data type
Size(column width).
Each table column definition is a single clause in the create table syntax. Each table column definition is separated from the other by a comma. Finally, the SQL statement is terminated with a semicolon.
The Structure of Create Table Command
Table name is Student
Column name
Data type
Size
Reg_no varchar2 10
Name char 30
DOB date
Address varchar2 50
Example:
CREATE TABLE Student
(Reg_no varchar2(10),
Name char(30),
DOB date,
Address varchar2(50));
The DROP Command
Syntax:
DROP TABLE <table_name>
Example:
DROP TABLE Student;
It will destroy the table and all data which will be recorded in it.
The TRUNCATE Command
Syntax:
TRUNCATE TABLE <Table_name>
Example:
TRUNCATE TABLE Student;
The RENAME Command
Syntax:
RENAME <OldTableName> TO <NewTableName>
Example:
RENAME <Student> TO <Stu>
! hope it will help! ☺️