1. SQL Statement Classifications
SQL statements are categorized based on their functional purpose within the database architecture:
-
Data Manipulation Language (DML): Retrieves data from the database, enters new rows, changes existing rows, and removes unwanted rows from tables in the database.
-
Commands:
SELECT,INSERT,UPDATE,DELETE,MERGE -
NOTE: While
SELECTis frequently categorized under DML in training curricula (including Oracle University), it is formally classified as Data Query Language (DQL).
-
Commands:
-
Data Definition Language (DDL): Sets up changes and removes data structures from tables and the database dictionary.
-
Commands:
CREATE,ALTER,DROP,RENAME,TRUNCATE,COMMENT -
IMPORTANT: DDL statements issue an implicit
COMMITbefore and after execution. They cannot be rolled back.
-
Commands:
-
Data Control Language (DCL): Gives or removes access rights to both the Oracle database and the structures within it.
-
Commands:
GRANT,REVOKE
-
Commands:
-
Transaction Control Language (TCL): Manages the changes made by DML statements. Changes to the data can be grouped together into logical transactions.
-
Commands:
COMMIT,ROLLBACK,SAVEPOINT
-
Commands:
2. Core Capabilities of SQL Select Statements
- Projection: Choosing the specific columns in a table that are returned by a query.
- Selection: Choosing the specific rows in a table that meet given conditions and are returned by a query.
- Joining: Bringing together data that is stored in different tables by specifying the link between them.
3. Syntax Terminology
-
Keyword: Refers to an individual SQL element or reserved word (e.g.,
SELECTandFROMare keywords). -
Clause: A distinct part of a SQL statement (e.g.,
SELECT employee_id, last_nameis a clause). -
Statement: A combination of two or more clauses forming a complete executable database instruction (e.g.,
SELECT * FROM employees;is a SQL statement).
Top comments (0)