DS-2002:
Data Systems
An Overview of the SQL Language
Prof. Jon Tupitza
The SQL Language
Understanding the Structured Query Language
The SQL Language: Principal Components
Three Primary Aspects of the ANSI-Compliant SQL Language
Data Definition Data Control Data Manipulation
Language (DDL) Language (DCL) Language (DML)
• CREATE, ALTER, • GRANT, REVOKE, • SELECT, INSERT, UPDATE,
DROP, TRUNCATE DENY, EXECUTE AS DELETE, MERGE, and
TABLE, ENABLE & • Used to control BULK INSERT
DISABLE TRIGGER access to server & • Used to manipulate
• Used to manage database objects database content (data)
database structures (permissions)
Microsoft Docs | Transact-SQL Reference (Database Engine)
Query a SQL Database: The SELECT Statement
Essential Components of Data Retrieval
for specifying the
SELECT required columns
Filtering Statements:
for specifying the
FROM Table(s) being targeted ON WHERE HAVING
for specifying
JOIN additional Table(s) specifies specifies
specifies
the conditions
conditions
for specifying points of column(s) by which
GROUP BY by which
aggregation that Groups or
to reduce
enable the Aggregates
the rows
joining of may be
for sorting rows of returned
ORDER BY the result set two Tables reduced
Database Transactions: Enforcing Data Integrity
The ACID Properties of a Transaction Must be Enforced to Ensure the Integrity of a Database
• All operations in a transaction must be treated as a single [atomic] unit, and must either be
Atomicity fully committed (i.e., succeed) or be rolled-back (i.e., have no effect whatsoever).
• Each transaction must guarantee the valid state of the database; both before and after the
Consistency transaction is either committed or rolled-back.
• All defined rules, constraints, and relationships must be enforced and maintained.
• Concurrent transactions must be completely independent; having no effect on each other.
Isolation • Transactions must remain invisible to each other until they are either committed or rolled-back.
• Once committed, the effects of each transaction must be permanently saved (written to disk);
even if the system fails amidst their execution.
Durability • A transaction log (aka, Journal file) serves as a write-ahead mechanism to ensure each
committed transaction can be replayed to successfully recover the database to a consistent
state in the event of a system failure.
Q&A
An Overview of SQL Databases