| id | 5_procedural_sql/README |
|---|---|
| title | Procedural SQL |
This folder contains examples related to procedural extensions to SQL, including stored procedures, triggers, and dynamic SQL.
- procedural_sql.sql - Examples of procedural SQL features
- CREATE PROCEDURE syntax
- Input and output parameters
- Local variables and control flow
- Error handling
- Calling procedures (CALL, EXECUTE)
- CREATE TRIGGER syntax
- Event triggers (BEFORE, AFTER)
- Row-level and statement-level triggers
- Trigger timing (INSERT, UPDATE, DELETE)
- Accessing OLD and NEW values
- EXECUTE IMMEDIATE
- PREPARE and EXECUTE statements
- Building SQL statements dynamically
- Parameter binding
- Security considerations (SQL injection)
- Data validation and transformation
- Complex business rules implementation
- Audit logging
- Automated maintenance tasks
- Report generation
- MySQL/MariaDB: Stored procedures with DELIMITER
- PostgreSQL: PL/pgSQL language
- Oracle: PL/SQL blocks
- SQL Server: T-SQL procedures
- Study the example file to understand procedural SQL concepts
- Experiment with creating your own procedures and triggers
- Practice implementing business logic in database procedures
- Learn to use dynamic SQL safely and effectively
This topic doesn't have specific problems from the problem set, as procedural SQL is typically part of database development rather than isolated query challenges. However, understanding these concepts is essential for building complex database applications and implementing business logic at the database level.