Till now?
08 February 2023 14:56
SQL DDL Commands Page 15
Installation
08 February 2023 16:05
SQL DDL Commands Page 16
What is SQL?
08 February 2023 14:56
SQL (Structured Query Language) is a programming language used for managing
and manipulating data in relational databases. It allows you to insert, update,
retrieve, and delete data in a database. It is widely used for data management in
many applications, websites, and businesses. In simple terms, SQL is used to
communicate with and control databases.
SQL DDL Commands Page 17
Types of SQL commands
08 February 2023 14:56
SQL DDL Commands Page 18
10 February 2023 20:16
SQL DDL Commands Page 19
DDL commands for Databases
08 February 2023 14:57
1. CREATE
2. DROP
SQL DDL Commands Page 20
DDL commands for Tables
08 February 2023 15:00
1. CREATE
2. TRUNCATE
3. DROP
SQL DDL Commands Page 21
Data Integrity
08 February 2023 15:00
Data integrity in databases refers to the accuracy, completeness, and consistency
of the data stored in a database. It is a measure of the reliability and
trustworthiness of the data and ensures that the data in a database is protected
from errors, corruption, or unauthorized changes.
There are various methods used to ensure data integrity, including:
Constraints:
Constraints in databases are rules or conditions that must be met for data to be
inserted, updated, or deleted in a database table. They are used to enforce the
integrity of the data stored in a database and to prevent data from becoming
inconsistent or corrupted.
Transactions: a sequence of database operations that are treated as a single unit
of work.
Normalization: a design technique that minimizes data redundancy and ensures
data consistency by organizing data into separate tables.
SQL DDL Commands Page 22
Constraints in MySQL
08 February 2023 15:01
Constraints in databases are rules or conditions that must be met for data to be
inserted, updated, or deleted in a database table. They are used to enforce the
integrity of the data stored in a database and to prevent data from becoming
inconsistent or corrupted.
1. NOT NULL
2. UNIQUE(combo)
-> Another way of creating constraint
3. PRIMARY KEY
4. AUTO INCREMENT
5. CHECK
6. DEFAULT
7. FOREIGN KEY
Referential Actions
1. RESTRICT
2. CASCADE
3. SET NULL
4. SET DEFAULT
SQL DDL Commands Page 23
SQL DDL Commands Page 24
ALTER TABLE command
08 February 2023 15:02
The "ALTER TABLE" statement in SQL is used to modify the structure of an
existing table. Some of the things that can be done using the ALTER TABLE
statement include
1. Add columns
2. Delete columns
3. Modify columns
SQL DDL Commands Page 25
Editing and Deleting Constraints
08 February 2023 15:02
1. Add
2. Delete
3. Edit
SQL DDL Commands Page 26