Name some common DDL commands.

By vivek kumar in 22 Jul 2024 | 07:53 pm
vivek kumar

vivek kumar

Student
Posts: 552
Member since: 20 Jul 2024

Name some common DDL commands.

22 Jul 2024 | 07:53 pm
0 Likes
Prince

Prince

Student
Posts: 557
Member since: 20 Jul 2024

Common Data Definition Language (DDL) commands include:


1. **CREATE**: Defines new database objects such as tables, indexes, or views.

   - Example: `CREATE TABLE employees (id INT PRIMARY KEY, name VARCHAR(100));`


2. **ALTER**: Modifies the structure of an existing database object.

   - Example: `ALTER TABLE employees ADD COLUMN email VARCHAR(255);`


3. **DROP**: Deletes a database object, such as a table, index, or view.

   - Example: `DROP TABLE employees;`


4. **TRUNCATE**: Removes all records from a table but retains the table structure for future use.

   - Example: `TRUNCATE TABLE employees;`


5. **RENAME**: Changes the name of an existing database object.

   - Example: `RENAME TABLE employees TO staff;`


These commands are essential for defining and managing the schema of a database.

23 Jul 2024 | 12:19 am
0 Likes

Report

Please describe about the report short and clearly.