1.3 Types of SQL Commands | DDL DML DQL
DCL TCL | auto-commit commands in sql |
Categories of SQL
elcome to my notes on Data Definition Language (DDL)! In these notes, I
W
will be focusing solely on DDL and its role in defining database structure.
Data Definition Language (DDL)
● D DL is a type of SQL language used to define and manage the
structure of a database
● DDL commands are used to create, alter, and delete database
objects such as tables, schemas, and views
Key DDL Commands:
● CREATE : used to create new database objects
● ALTER : used to modify the structure of existing database objects
● : used to delete database objects
DROP
Create Command:
● C REATE TABLE table_name (column1 datatype
constraints, column2 datatype constraints, ...);
● Example:
CREATE TABLE employees (id INT PRIMARY
KEY, name TEXT, salary DECIMAL(5,2));
Alter Command:
● A LTER TABLE table_name ADD/DROP/CHANGE
column_name datatype constraints;
● Example: ALTER TABLE employees ADD department TEXT;
● Example:ALTER TABLE employees DROP id;
● Example:
ALTER TABLE employees CHANGE name
employee_name TEXT;
DCL TCL | auto-commit commands in sql |
Categories of SQL
elcome to my notes on Data Definition Language (DDL)! In these notes, I
W
will be focusing solely on DDL and its role in defining database structure.
Data Definition Language (DDL)
● D DL is a type of SQL language used to define and manage the
structure of a database
● DDL commands are used to create, alter, and delete database
objects such as tables, schemas, and views
Key DDL Commands:
● CREATE : used to create new database objects
● ALTER : used to modify the structure of existing database objects
● : used to delete database objects
DROP
Create Command:
● C REATE TABLE table_name (column1 datatype
constraints, column2 datatype constraints, ...);
● Example:
CREATE TABLE employees (id INT PRIMARY
KEY, name TEXT, salary DECIMAL(5,2));
Alter Command:
● A LTER TABLE table_name ADD/DROP/CHANGE
column_name datatype constraints;
● Example: ALTER TABLE employees ADD department TEXT;
● Example:ALTER TABLE employees DROP id;
● Example:
ALTER TABLE employees CHANGE name
employee_name TEXT;