What are the 4 parts of SQL?
These parts represent different functionalities within SQL.
What does SQL as a whole represent?
A complete toolkit for building, managing, securing, and safely modifying databases
SQL encompasses various operations for database management.
What is the purpose of DDL?
To build and change the structure of the database
DDL stands for Data Definition Language.
What does CREATE do?
Creates new objects like tables, views, indexes
CREATE is a fundamental command in DDL.
What does ALTER do?
Modifies an existing table’s structure (add/rename/change columns)
ALTER allows changes to the schema of a table.
What does DROP do?
Permanently deletes a table or object — no undo
DROP removes objects from the database entirely.
What does TRUNCATE do?
Deletes all rows but keeps the table structure
TRUNCATE is faster than DELETE as it does not log individual row deletions.
What’s the analogy for CREATE?
Constructing a new building
This analogy illustrates the creation of new database objects.
What’s the analogy for ALTER?
Renovating a room
This analogy represents modifying existing structures.
What’s the analogy for DROP?
Demolishing a building
This analogy signifies the complete removal of database objects.
What’s the analogy for TRUNCATE?
Clearing a building of furniture
This analogy emphasizes the removal of data while retaining the structure.
What does CREATE TABLE define?
Columns + data types (blueprint for data)
CREATE TABLE is essential for establishing a new table.
What is a VIEW?
A virtual window into data (a saved SELECT query)
Views simplify data access and can encapsulate complex queries.
What is CREATE INDEX used for?
Speeding up searching (like a book index)
Indexes improve query performance significantly.
What does a SCHEMA do?
Groups related tables together
Schemas help organize database objects.
What is a TRIGGER?
Automatic actions that run when something happens (e.g., auto email)
Triggers can enforce business rules automatically.
What is the purpose of DML?
To work with the actual data inside tables
DML stands for Data Manipulation Language.
What does SELECT do?
Retrieves data
SELECT is the primary command for data retrieval.
What does INSERT do?
Adds new rows of data
INSERT is used to populate tables with data.
What does UPDATE do?
Changes existing data
UPDATE modifies records in a table.
What does DELETE do?
Removes rows
DELETE is used to remove specific records from a table.
Why must you use WHERE with UPDATE/DELETE?
Without WHERE, you update/delete everything
Using WHERE ensures targeted modifications.
What’s the analogy for DML?
Living inside the house after it’s built
This analogy illustrates working with data after its structure is established.
What is the purpose of DCL?
Controls who can access or modify data — security
DCL stands for Data Control Language.