Update docs/tech_docs/sql_notes.md
This commit is contained in:
@@ -1,3 +1,45 @@
|
||||
# Fundamentals of SQL: A Concise Overview
|
||||
|
||||
SQL, or Structured Query Language, is the standard language for relational database management and data manipulation. It's divided into various categories, each serving a specific aspect of database interaction: Data Manipulation Language (DML), Data Definition Language (DDL), Data Control Language (DCL), and Transaction Control Language (TCL).
|
||||
|
||||
## Data Manipulation Language (DML)
|
||||
|
||||
DML commands are pivotal for day-to-day operations on data stored within database tables.
|
||||
|
||||
- **SELECT**: Retrieves data from one or more tables, supporting operations like sorting (`ORDER BY`) and filtering (`WHERE`).
|
||||
- **INSERT**: Adds new rows to a table, specifying columns and corresponding values.
|
||||
- **UPDATE**: Alters existing records in a table based on specified conditions, allowing changes to one or multiple rows.
|
||||
- **DELETE**: Eliminates specified rows from a table, with the capability to delete all rows when conditions are omitted or generalized.
|
||||
|
||||
## Data Definition Language (DDL)
|
||||
|
||||
DDL commands focus on the structural blueprint of the database, facilitating the creation and modification of schemas.
|
||||
|
||||
- **CREATE**: Initiates new database objects, like tables or views, defining their structure and relationships.
|
||||
- **ALTER**: Adjusts existing database object structures, enabling the addition, modification, or deletion of columns and constraints.
|
||||
- **DROP**: Completely removes database objects, erasing their definitions and data.
|
||||
- **TRUNCATE**: Efficiently deletes all rows from a table, resetting its state without affecting its structure.
|
||||
|
||||
## Data Control Language (DCL)
|
||||
|
||||
DCL commands govern the access and permissions for database objects, ensuring secure data management.
|
||||
|
||||
- **GRANT**: Assigns specific privileges to users or roles, covering actions like SELECT, INSERT, UPDATE, and DELETE.
|
||||
- **REVOKE**: Withdraws previously granted privileges, tightening control over database access.
|
||||
|
||||
## Transaction Control Language (TCL)
|
||||
|
||||
TCL commands provide control over transactional operations, ensuring data integrity and consistency through atomic operations.
|
||||
|
||||
- **COMMIT**: Finalizes the changes made during a transaction, making them permanent and visible to all subsequent transactions.
|
||||
- **ROLLBACK**: Undoes changes made during the current transaction, reverting to the last committed state.
|
||||
- **SAVEPOINT**: Establishes checkpoints within a transaction, to which one can revert without affecting the entire transaction.
|
||||
- **SET TRANSACTION**: Specifies transaction properties, including isolation levels which dictate visibility between concurrent transactions and access mode (read/write).
|
||||
|
||||
Understanding and effectively utilizing these SQL command categories enhances database management, promotes data integrity, and supports robust data manipulation and access control strategies. Each plays a vital role in the comprehensive management of relational databases, catering to various needs from basic data handling to complex transaction management and security enforcement.
|
||||
|
||||
---
|
||||
|
||||
When facing complaints about a slow database, where the presumption is a database issue, it's crucial to approach troubleshooting systematically. Performance issues can stem from a myriad of factors, from query inefficiency, hardware limitations, to configuration missettings. This advanced technical guide aims to equip database administrators (DBAs) and developers with strategies to diagnose and resolve database performance bottlenecks.
|
||||
|
||||
# Advanced Technical Guide: Troubleshooting a Slow Database
|
||||
|
||||
Reference in New Issue
Block a user